Re: Confused about diff-tree --cc output

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

 



On Wed, Feb 4, 2009 at 4:56 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> I think this is "more than two versions", in
>
>    http://thread.gmane.org/gmane.comp.version-control.git/15486/focus=15491
>
> Nothing new to see here, I think.

Okay, let me just make sure I understand. The output of git show has:

diff --cc builtin-remote.c
index abc8dd8,07cfdac..db18bcf

So, I can do:

git diff abc8dd8 db18bcf > parent1.diff
git diff 07cfdac db18bcf > parent2.diff

Then look at each for overlapping hunks. If I do so, I find that this
hunk in parent1.diff (I've annotated w/line numbers):

@@ -542,8 +552,11 @@ static int rm(int argc, const char **argv)
552 	struct strbuf buf = STRBUF_INIT;
553 	struct known_remotes known_remotes = { NULL, NULL };
554 	struct string_list branches = { NULL, 0, 0, 1 };
   -	struct branches_for_remote cb_data = { NULL, &branches, &known_remotes };
   -	int i;
555+	struct string_list skipped = { NULL, 0, 0, 1 };
556+	struct branches_for_remote cb_data = {
557+		NULL, &branches, &skipped, &known_remotes
558+	};
559+	int i, result;
560
561 	if (argc != 2)
562 		usage_with_options(builtin_remote_usage, options);

and this hunk in parent2.diff:

@@ -362,7 +549,7 @@ static int rm(int argc, const char **argv)
549 		OPT_END()
550 	};
551 	struct remote *remote;
   -	struct strbuf buf;
552+	struct strbuf buf = STRBUF_INIT;
553 	struct known_remotes known_remotes = { NULL, NULL };
554 	struct string_list branches = { NULL, 0, 0, 1 };
555 	struct string_list skipped = { NULL, 0, 0, 1 };

overlap (lines 552-555). Since the hunks overlap, and each introduces
a unique change, both hunks are shown in the combined format. I guess
this makes sense now that I know how it works, but my expectation had
been that I'd only see output if there was a merge conflict.

I also note that "git diff-tree -U2 --cc 8554af" produces no output,
and this is because there is no longer overlap (well, the context
lines overlap, but are identical, which I guess is good enough).

Is that about right?

(Aside, to reconstruct the merge manually I did the following, but I
bet there is an easier way:

git show 3613d1d:builtin-remote.c > mine
git show 441adf0:builtin-remote.c > other
git show $(git merge-base 3613d1d 441adf0):builtin-remote.c > base
git merge-file -p mine base other
)

j.
--
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]

  Powered by Linux