[v3,2/3] diff-files: fix incorrect usage of an empty tree
diff mbox series

Message ID a9e06427ec4661b105f57ccf4ce5e842ba501a99.1593010066.git.gitgitgadget@gmail.com
State New
Headers show
  • Fix difftool problem with intent-to-add files
Related show

Commit Message

Philippe Blain via GitGitGadget June 24, 2020, 2:47 p.m. UTC
From: Johannes Schindelin <johannes.schindelin@gmx.de>

In c26022ea8f5 (diff: convert diff_addremove to struct object_id,
2017-05-30), the OID to use for intent-to-add files was inadvertently
changed from the empty blob to the empty tree.

Let's revert that.

To be able to do that, we just taught the regression test introduced in
feea6946a5b (diff-files: treat "i-t-a" files as "not-in-index",
2020-06-20) to _not_ expect the raw diff to contain the hash of the
empty tree (we also had to fix the code to actually produce the expected
output, but for the sake of this here patch, that's beside the point).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
 diff-lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff mbox series

diff --git a/diff-lib.c b/diff-lib.c
index ea23169afa..7aafd7cc37 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -234,7 +234,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,
+					       the_hash_algo->empty_blob, 0,
 					       ce->name, 0);