I use this to check that git repos have nothing untracked:
# 1st command: check index against HEAD
# 2nd command: check working tree against index
# 3rd command: check for untracked files
# 4th command: check for stashes
git diff-index --quiet --cached HEAD \
&& git diff-files --quiet \
&& test -z "$(git status --porcelain)" \
&& test -z "$(git stash list)"
The call to git-diff-files(1) fails in a v7 repo with output like this (if I drop the --quiet
):
spwhitton@iris:~/lib/athena-apt>git diff-files
:100644 100644 f8e47b9532ea17ac825c39bddc35dbd68f120a46 0000000000000000000000000000000000000000 M dists/buster-backports/main/binary-amd64/Packages
:100644 100644 f8e47b9532ea17ac825c39bddc35dbd68f120a46 0000000000000000000000000000000000000000 M dists/buster-backports/main/binary-i386/Packages
:100644 100644 f8e47b9532ea17ac825c39bddc35dbd68f120a46 0000000000000000000000000000000000000000 M dists/buster/main/binary-amd64/Packages
:100644 100644 f8e47b9532ea17ac825c39bddc35dbd68f120a46 0000000000000000000000000000000000000000 M dists/buster/main/binary-i386/Packages
:100644 100644 f8e47b9532ea17ac825c39bddc35dbd68f120a46 0000000000000000000000000000000000000000 M dists/rc-buggy/main/binary-amd64/Packages
:100644 100644 f8e47b9532ea17ac825c39bddc35dbd68f120a46 0000000000000000000000000000000000000000 M dists/rc-buggy/main/binary-i386/Packages
:100644 100644 f8e47b9532ea17ac825c39bddc35dbd68f120a46 0000000000000000000000000000000000000000 M dists/sid/main/binary-amd64/Packages
:100644 100644 f8e47b9532ea17ac825c39bddc35dbd68f120a46 0000000000000000000000000000000000000000 M dists/sid/main/binary-i386/Packages
:100644 100644 f8e47b9532ea17ac825c39bddc35dbd68f120a46 0000000000000000000000000000000000000000 M dists/stretch/main/binary-amd64/Packages
:100644 100644 f8e47b9532ea17ac825c39bddc35dbd68f120a46 0000000000000000000000000000000000000000 M dists/stretch/main/binary-i386/Packages
I note that the listed files are empty.
Is there a git-annex command that I can run to normalise my repo so that git-diff-files(1) produces no output? Or does it not make sense to run git-diff-files(1) in a v7 repo?
Thanks.
--spwhitton
So specifically, this happens for unlocked files in a v7 repository, but only when the files are empty.
I suspect this is a bug in git. It might have something to do with the mention in git-diff-files(1) and git-diff(1) about empty files:
And
git diff
similarly shows a diff for these empty unlocked files.Makes me suspect there's some hack going on in git WRT empty files and perhaps it bypasses the smudge/clean filters?
I usually use
git diff --cached
for this kind of thing, and it doesn't have the problem, but I don't know if it meets your needs either.