git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Johannes Sixt <j6t@kdbg.org>,
	"B. Stebler" <bono.stebler@gmail.com>,
	git@vger.kernel.org
Subject: Re: Improving merge of tricky conflicts
Date: Thu, 23 Jul 2020 18:19:19 -0700	[thread overview]
Message-ID: <xmqqk0ytn208.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200723182549.GB3975154@coredump.intra.peff.net> (Jeff King's message of "Thu, 23 Jul 2020 14:25:49 -0400")

Jeff King <peff@peff.net> writes:

> sub flush {
>   print @ours;
>   print "|||||||\n";
>   show_diff(base => \@base, ours => \@ours);
>   print "|||||||\n";
>   show_diff(base => \@base, theirs => \@theirs);
>   print "=======\n";

Before this gets called, "<<<<<<<\n" from the original has been
emitted to the output, so this shows

	<<<<<<<
	version from ours
	|||||||
	output from diff -u base ours
	|||||||
	output from diff -u base theirs
	=======
	version from theirs

   print @theirs;
>   @ours = @base = @theirs = ();
> }

Unfortunately, there is no ">>>>>>>" shown with this code, as $_
seems to get clobbered before the sub returns, so ...

> sub state_theirs {
>   if (/^>{7}/) { flush(); print; $state = \&state_none }
>   else { push @theirs, $_ }
> }

... that "print" does not do what we want it to do.

Localizing the $_ upfront in the show_diff sub should probably be
sufficient.  That is ...

> sub show_diff {
>   my ($pre_name, $pre_data, $post_name, $post_data) = @_;

+  local ($_);

... here.

>
>   my $pre = File::Temp->new;
>   print $pre @$pre_data;

I am debating myself if I want to see the base version between these
two extra diffs.  Perhaps there is no need, as either one of these
two extra diffs should be sufficient to see what was in the base
version.

Thanks.

  reply	other threads:[~2020-07-24  1:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21 23:29 Improving merge of tricky conflicts B. Stebler
2020-07-22  5:50 ` Johannes Sixt
2020-07-22  7:45   ` Jeff King
2020-07-22 17:26     ` Junio C Hamano
2020-07-23 18:25       ` Jeff King
2020-07-24  1:19         ` Junio C Hamano [this message]
2020-07-24 19:48           ` Jeff King
2020-07-24 20:18             ` Junio C Hamano
2021-01-16  2:50         ` Martin von Zweigbergk
2021-01-21 14:28           ` Jeff King
2021-01-21 20:30             ` Martin von Zweigbergk
2021-01-21 21:08               ` Jeff King
2020-07-22 20:17   ` Sergey Organov
2020-07-22 21:14     ` Junio C Hamano
2020-07-22 21:20       ` Sergey Organov
2020-07-23 18:26         ` Jeff King
2020-07-23 19:11           ` Sergey Organov
2020-07-23 21:39             ` Junio C Hamano
2020-07-24  5:15               ` Jacob Keller
2020-07-24  6:01                 ` Junio C Hamano
2020-07-24  6:53               ` Sergey Organov
2020-07-24 20:30                 ` Junio C Hamano
2020-07-24 22:11                   ` Sergey Organov
2020-07-24 23:04                     ` Junio C Hamano
2020-07-22 22:48   ` Bono Stebler

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqk0ytn208.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=bono.stebler@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=peff@peff.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).