Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from diff-index to diff #9

Merged
merged 1 commit into from
Sep 2, 2024
Merged

Conversation

nickcharlton
Copy link
Owner

diff-index:

Compare the content and mode of the blobs found in a tree object
with the corresponding tracked files in the working tree, or with
the corresponding paths in the index.

Unlike diff, which only compares the content. This has the implication (only on Linux) that if you were to recreate a file (or do something like change a file's timestamp with touch, as in the test) then a check with diff-index would drop us into that code path for there to subsequently be no known files which had changed.

This behaviour came up when testing with Appraisal, which re-creates lockfiles when run, but the content is the same.

https://stackoverflow.com/questions/24197606/whats-the-difference-between-git-diff-and-gif-diff-index https://github.com/thoughtbot/appraisal

`diff-index`:

    Compare the content and mode of the blobs found in a tree object
    with the corresponding tracked files in the working tree, or with
    the corresponding paths in the index.

Unlike `diff`, which only compares the content. This has the implication
(only on Linux) that if you were to recreate a file (or do something
like change a file's timestamp with `touch`, as in the test) then a
check with `diff-index` would drop us into that code path for there to
subsequently be no known files which had changed.

This behaviour came up when testing with Appraisal, which re-creates
lockfiles when run, but the content is the same.

https://stackoverflow.com/questions/24197606/whats-the-difference-between-git-diff-and-gif-diff-index
https://github.com/thoughtbot/appraisal
@nickcharlton nickcharlton merged commit 9fa7ac2 into main Sep 2, 2024
1 check passed
@nickcharlton nickcharlton deleted the prefer-diff-over-diff-index branch September 2, 2024 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant