git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jay Soffian <jaysoffian@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Confused about diff-tree --cc output
Date: Wed, 4 Feb 2009 22:49:34 -0500	[thread overview]
Message-ID: <76718490902041949v8fffd17l7cb19d836a3e1887@mail.gmail.com> (raw)
In-Reply-To: <7vk585n9x8.fsf@gitster.siamese.dyndns.org>

On Wed, Feb 4, 2009 at 4:56 PM, Junio C Hamano <gitster@pobox.com> 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.

  reply	other threads:[~2009-02-05  3:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-04 21:13 Confused about diff-tree --cc output Jay Soffian
2009-02-04 21:56 ` Junio C Hamano
2009-02-05  3:49   ` Jay Soffian [this message]
2009-02-05  8:38     ` Junio C Hamano
2009-02-05  8:57       ` Jay Soffian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76718490902041949v8fffd17l7cb19d836a3e1887@mail.gmail.com \
    --to=jaysoffian@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).