whereused: Fix bug that could find matches from grafts in remote git-annex branches

git log with --remotes= needs the preceeding --exclude=*/git-annex in order
to not look at git-annex branches of remotes.

Sponsored-by: mycroft
This commit is contained in:
Joey Hess 2025-05-05 14:31:47 -04:00
parent 2bafd907b2
commit e64e9d5fae
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 30 additions and 1 deletions

View file

@ -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

View 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=*"

View file

@ -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
"""]]