whereused: Fix bug that could find matches from grafts in remote git-annex branches
authorJoey Hess <joeyh@joeyh.name>
Mon, 5 May 2025 18:31:47 +0000 (14:31 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 5 May 2025 18:32:25 +0000 (14:32 -0400)
git log with --remotes= needs the preceeding --exclude=*/git-annex in order
to not look at git-annex branches of remotes.

Sponsored-by: mycroft
CHANGELOG
Command/WhereUsed.hs
doc/bugs/whereused_--key_forcing_--historical._exportree__63__/comment_2_b574973835ee61fa8711831e38b77ad2._comment [new file with mode: 0644]

index f0eeb7b610d0afba510f5d2345c06ea830cc6843..f96e750319403601e57a59ba9b658d047ed7caa3 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,8 @@ git-annex (10.20250417) UNRELEASED; urgency=medium
     accessed via ssh.
   * map: Avoid looping forever with mutually recursive paths between
     repositories accessed via ssh.
+  * whereused: Fix bug that could find matches from grafts 
+    in remote git-annex branches.
 
  -- Joey Hess <id@joeyh.name>  Tue, 22 Apr 2025 14:33:26 -0400
 
index 1a7e7033d8d3ee2e9f498b0961f17e48ef517e4b..28ae74585b16461315d859a3df3a7a04ef74716f 100644 (file)
@@ -89,7 +89,7 @@ findHistorical key = do
                [ Param ("--exclude=*/" ++ fromRef (Annex.Branch.name))
                , Param "--glob=*"
                -- Also search remote branches
-               , Param ("--exclude=" ++ fromRef (Annex.Branch.name))
+               , Param ("--exclude=*/" ++ fromRef (Annex.Branch.name))
                , Param "--remotes=*"
                -- And search tags.
                , Param "--tags=*"
diff --git a/doc/bugs/whereused_--key_forcing_--historical._exportree__63__/comment_2_b574973835ee61fa8711831e38b77ad2._comment b/doc/bugs/whereused_--key_forcing_--historical._exportree__63__/comment_2_b574973835ee61fa8711831e38b77ad2._comment
new file mode 100644 (file)
index 0000000..4a2fb4f
--- /dev/null
@@ -0,0 +1,27 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2025-05-05T18:12:16Z"
+ content="""
+I was able to reproduce the "origin/git-annex~12:export.tree" part of this
+and have fixed that, so it won't show that git-annex branch location,
+which is part of git-annex's internal bookkeeping and not something useful
+for the command to display.
+
+As to why it is not finding your file, what you show is not necessarily a
+bug. If the file `2010-08-21/042.JPG` is not staged in git, it won't be
+shown by `git-annex whereused` when run without --historical. It's easy
+enough to get into such a situation, for example you could have run a
+series of commands like this:
+
+       git-annex add 042.JPG
+       mv 042.JPG 2010-08-21/042.JPG
+       git commit -a -m foo
+
+If the file is in fact staged in git and whereused doesn't list it,
+my next guess would be that somehow it's not getting added to the
+associated files database, which is what whereused looks at.
+You can check for that with this command:
+
+       sqlite3 .git/annex/keysdb/db 'select * from associated;'| grep SHA256E-s1000013--e435522a9059bcb086b6db5fa5f05a06913266772a7931eefae2b8f7647f5f14.JPG
+"""]]