path: root/t/
diff options
authorJohannes Schindelin <>2020-07-01 21:19:06 (GMT)
committerJunio C Hamano <>2020-07-01 23:15:43 (GMT)
commit85953a318734a9ad479626fbe53985da1475ec0b (patch)
treeaeda9f205abcf1de8e5c7734c460a0183faa7c9a /t/
parentfeea6946a5b746ff4ebf8ccdf959e303203a6011 (diff)
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 c26022ea8f5 (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 feea6946a5b (diff-files: treat "i-t-a" files as "not-in-index", 2020-06-20). Signed-off-by: Johannes Schindelin <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 2 insertions, 3 deletions
diff --git a/t/ b/t/
index 8a5d550..cf0175a 100755
--- a/t/
+++ b/t/
@@ -240,7 +240,6 @@ test_expect_success 'i-t-a files shown as new for "diff", "diff-files"; not-new
hash_e=$(git hash-object empty) &&
hash_n=$(git hash-object not-empty) &&
- hash_t=$(git hash-object -t tree /dev/null) &&
cat >expect.diff_p <<-EOF &&
diff --git a/empty b/empty
@@ -259,8 +258,8 @@ test_expect_success 'i-t-a files shown as new for "diff", "diff-files"; not-new
create mode 100644 not-empty
cat >expect.diff_a <<-EOF &&
- :000000 100644 0000000 $(git rev-parse --short $hash_t) A$(printf "\t")empty
- :000000 100644 0000000 $(git rev-parse --short $hash_t) A$(printf "\t")not-empty
+ :000000 100644 0000000 0000000 A$(printf "\t")empty
+ :000000 100644 0000000 0000000 A$(printf "\t")not-empty
git add -N empty not-empty &&