forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix git difftool
with intent-to-add files
#2733
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The `diff-files' command and related commands which call the function `cmd_diff_files()', consider the "intent-to-add" files as a part of the index when comparing the work-tree against it. This was previously addressed in commits [1] and [2] by turning the option `--ita-invisible-in-index' (introduced in [3]) on by default. For `diff-files' (and `add -p' as a consequence) to show the i-t-a files as as new, `ita_invisible_in_index' will be enabled by default here as well. [1] 0231ae7 (diff: turn --ita-invisible-in-index on by default, 2018-05-26) [2] 425a28e (diff-lib: allow ita entries treated as "not yet exist in index", 2016-10-24) [3] b42b451 (diff: add --ita-[in]visible-in-index, 2016-10-24) Signed-off-by: Srinidhi Kaushik <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
The documented behavior of `git diff-files --raw` is to display [...] 0{40} if creation, unmerged or "look at work tree". on the right hand (i.e. postimage) side. This happens for files that have unstaged modifications, and for files that are unmodified but stat-dirty. For intent-to-add files, we used to show the empty blob's hash instead. In c26022e (diff: convert diff_addremove to struct object_id, 2017-05-30), we made that worse by inadvertently changing that to the hash of the empty tree. Let's make the behavior consistent with files that have unstaged modifications (which applies to intent-to-add files, too) by showing all-zero values also for intent-to-add files. Accordingly, this patch adjusts the expectations set by the regression test introduced in feea694 (diff-files: treat "i-t-a" files as "not-in-index", 2020-06-20). Signed-off-by: Johannes Schindelin <[email protected]>
In git-for-windows#2677, a `git difftool -d` problem was reported. The underlying cause was a bug in `git diff-files --raw` that we just fixed: it reported intent-to-add files with the empty _tree_ as the post-image OID, when we need to show an all-zero (or, "null") OID instead, to indicate to the caller that they have to look at the worktree file. The symptom of that problem shown by `git difftool` was this: error: unable to read sha1 file of <path> (<empty-tree-OID>) error: could not write '<filename>' Make sure that the reported `difftool` problem stays fixed. Signed-off-by: Johannes Schindelin <[email protected]>
I'll merge this even if the respective patches just hit git/git's main branch (and will therefore be in |
git-for-windows-ci
pushed a commit
that referenced
this pull request
Jul 7, 2020
Fix `git difftool` with intent-to-add files
git-for-windows-ci
pushed a commit
that referenced
this pull request
Jul 7, 2020
Fix `git difftool` with intent-to-add files
dscho
added a commit
that referenced
this pull request
Jul 8, 2020
Fix `git difftool` with intent-to-add files
git-for-windows-ci
pushed a commit
that referenced
this pull request
Jul 9, 2020
Fix `git difftool` with intent-to-add files
dscho
added a commit
that referenced
this pull request
Jul 9, 2020
Fix `git difftool` with intent-to-add files
git-for-windows-ci
pushed a commit
that referenced
this pull request
Jul 9, 2020
Fix `git difftool` with intent-to-add files
git-for-windows-ci
pushed a commit
that referenced
this pull request
Jul 9, 2020
Fix `git difftool` with intent-to-add files
git-for-windows-ci
pushed a commit
that referenced
this pull request
Jul 13, 2020
Fix `git difftool` with intent-to-add files
dscho
added a commit
that referenced
this pull request
Jul 17, 2020
Fix `git difftool` with intent-to-add files
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #2677