git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ryan Zoeller <rtzoeller@rtzoeller.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Specify resume point with git difftool?
Date: Mon, 16 Nov 2020 11:26:36 -0800	[thread overview]
Message-ID: <xmqq36199k7n.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <gOXOaoqn-E9A2ob7ykWEcDc7ZxmSwAjcP5CCFKfr5ejCOWZQ1lfAUZcbgYT9AyQCcDgJvCrnrtziXiels-Hxol3xlkGTVHk24SvAdaSUtKQ=@rtzoeller.com> (Ryan Zoeller's message of "Mon, 16 Nov 2020 16:45:02 +0000")

Ryan Zoeller <rtzoeller@rtzoeller.com> writes:

> Is there a way to tell git "resume the difftool process at file n"?
> The difftool prompt counts which file I'm on ("Viewing (10/20):
> 'filename'"), so it seems like I ought to be able to jump ahead by
> specifying a starting index (or range to view).

There is no such support in the code.

diff.c::run_external_diff() maitains and increments the counters
used to show the prompt in the form of a pair of environment
variables, GIT_DIFF_PATH_TOTAL and GIT_DIFF_PATH_COUNTER, and they
are used in git-difftool--helper::launch_merge_tool() when asking
you if you want to run the difftool backend on that 10th file out of
the 20 files.

Right now, you can only say Yes or No to that prompt, but it
shouldn't be too hard to add another choice to the response to the
prompt, saying "skip to 15th file", for example, and record that
"15" in a temporary file in $GIT_DIR/ and exit without running the
difftool backend on the 10th file, so that later invocation of the
git-difftool-helper script can skip without prompting you until it
is the turn for 15th file.

The launch_merge_tool() function needs to be modified in the
following way to do so:

 - At the beginning, see if $GIT_DIR/difftool-skip-to file exists.

   - If exists, read its contents.

   - See if the value is larger than $GIT_DIFF_PATH_COUNTER.  If so,
     just 'return' without doing anything else.

   - Remove that file (we are at the 15th path and done skipping).

 - Update the "Viewing .../ Launch?" prompt and offer another choice
   "Skip to?".

 - Update the if/then/fi statement that processes the answer to the
   prompt (right now, it takes n as a sign to skip the file).  When
   the user says "skip to 15th", create $GIT_DIR/difftool-skip-to
   file and record "15" in it and 'return'.

#leftoverbits.





     


  reply	other threads:[~2020-11-16 19:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 16:45 Specify resume point with git difftool? Ryan Zoeller
2020-11-16 19:26 ` Junio C Hamano [this message]
2021-02-07 12:57 胡哲宁

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=xmqq36199k7n.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rtzoeller@rtzoeller.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).