Closed mih closed 3 months ago
Here is another one, seem the issues is "fixed" by an intermediate call to git diff
(which reports an empty diff).
❯ git st
modified: src/linkml/schemas/datalad-dataset-components.yaml (file)
untracked: src/examples/datalad-dataset.jsonld
❯ git st
modified: src/linkml/schemas/datalad-dataset-components.yaml (file)
untracked: src/examples/datalad-dataset.jsonld
❯ git diff
❯ git st
untracked: src/examples/datalad-dataset.jsonld
I have a situation now, where I have a file open in vim
. The file is in a plain Git repo, tracked, and has no modifications wrt to the committed state.
After I save the file in vim, no modifications, just :write
, I see this "wrong" report.
❯ datalad next-status
modified: src/examples/dataset-version/DatasetVersionObject-penguins.yaml (file)
The cause for this report is that git diff-index
shows it too!
❯ git diff-index HEAD
:100644 100644 03657a3bf83d09a48060228feed6a70237ef4600 0000000000000000000000000000000000000000 M src/examples/dataset-version/DatasetVersionObject-penguins.yaml
As soon as I run git diff
or git status
it is gone, as soon as I save the file in vim again, it is back:
❯ git diff
❯ git diff-index HEAD
❯ git diff-index HEAD
:100644 100644 03657a3bf83d09a48060228feed6a70237ef4600 0000000000000000000000000000000000000000 M src/examples/dataset-version/DatasetVersionObject-penguins.yaml
https://stackoverflow.com/questions/34807971/why-does-git-diff-index-head-result-change-for-touched-files-after-git-diff-or-g has an explanation and possible mitigation strategy.
But there is more to this issue. I can do the exact same action (open README.md file in vim, make no change, but write it out again) in two different repos. I get the modification report on one repo (clone of https://github.com/psychoinformatics-de/datalad-concepts), but not another (clone of https://github.com/datalad/datalad-next).
Here is an example log of a bunch of command I ran within a few seconds:
(
git st
is actually an alias todatalad next-status -r mono
)Something like this has happened more than once. The repository here is small, no annexed files (not even an annex at all). So this is not about smudge filters or anything in that direction. But clearly, the implementation in
next-status
suffers from something that is either fixed by time, or by callinggit diff/status
directly.