Re* BUG?: git diff with 3 args consults work tree when it shouldn't

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What happens is that the more-than-two-ways combined diff is sometimes
used to show the difference _to_ the working tree files.

In combine-diff.c::show_patch_diff(), we try to detect that case by
checking if sha1 recorded as "the result" is null, because diff-files will
give us 0{40} as the blob object name for files in the working tree.

Unfortunately, that forgets another case where blob object is null, which
is when the merge result tree _deleted_ the path.

This patch is not tested outside your test case. IOW, I know it will get
three-tree case correctly, but I didn't test it with cases where we should
look at the working tree files, so this may introduce regressions.

See 713a11f (combine-diff: diff-files fix., 2006-02-13) if you are
interested. I suspect that we may need to add a bit to the API to tell
this function if the end result is in the working tree.

 combine-diff.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/combine-diff.c b/combine-diff.c
index be67cfc..b4f1050 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -777,7 +777,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
 	struct sline *sline; /* survived lines */
 	int mode_differs = 0;
 	int i, show_hunks;
-	int working_tree_file = is_null_sha1(elem->sha1);
+	int working_tree_file = is_null_sha1(elem->sha1) && elem->mode;
 	mmfile_t result_file;
 	struct userdiff_driver *userdiff;
 	struct userdiff_driver *textconv = NULL;
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]