diff-files --raw: show correct post-image of intent-to-add files
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 c26022ea8f (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 feea6946a5 (diff-files: treat "i-t-a" files as
"not-in-index", 2020-06-20).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
feea6946a5
commit
85953a3187
@ -220,8 +220,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
|
||||
} else if (revs->diffopt.ita_invisible_in_index &&
|
||||
ce_intent_to_add(ce)) {
|
||||
diff_addremove(&revs->diffopt, '+', ce->ce_mode,
|
||||
the_hash_algo->empty_tree, 0,
|
||||
ce->name, 0);
|
||||
&null_oid, 0, ce->name, 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user