# Specify resume point with git difftool?

2 messages from 2020-11-16 to 2020-11-16. Participants: Ryan Zoeller, Junio C Hamano.
Thread: https://gitlist.dev/t/54652

## Ryan Zoeller, 2020-11-16 16:45

Subject: Specify resume point with git difftool?
Message-ID: <gOXOaoqn-E9A2ob7ykWEcDc7ZxmSwAjcP5CCFKfr5ejCOWZQ1lfAUZcbgYT9AyQCcDgJvCrnrtziXiels-Hxol3xlkGTVHk24SvAdaSUtKQ=@rtzoeller.com>
URL: https://gitlist.dev/e/gOXOaoqn-E9A2ob7ykWEcDc7ZxmSwAjcP5CCFKfr5ejCOWZQ1lfAUZcbgYT9AyQCcDgJvCrnrtziXiels-Hxol3xlkGTVHk24SvAdaSUtKQ%3D%40rtzoeller.com

```
Hi everyone,

I use git quite a bit while working with some binary files which require a custom diff tool. I'll typically review changes with a command like

git difftool --tool toolname main... -- *.extension

Frequently I'll finish reviewing a file and close the diffing program, only to realize that I wanted to look at part of the diff again -- e.g. after viewing a few other files and wanting some additional context.

Typically I end up killing the current difftool prompt, rewriting my difftool command to specify the file I want to re-review, and upon finishing that re-review running the original difftool command. However upon running the original command I find myself just answering 'n' to all of the prompts until I get back to where I was, which can be a bit painful.

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).

Thanks,
Ryan Zoeller


```

## Junio C Hamano, 2020-11-16 19:26

Subject: Re: Specify resume point with git difftool?
Message-ID: <xmqq36199k7n.fsf@gitster.c.googlers.com>
URL: https://gitlist.dev/e/xmqq36199k7n.fsf%40gitster.c.googlers.com
In-Reply-To: <gOXOaoqn-E9A2ob7ykWEcDc7ZxmSwAjcP5CCFKfr5ejCOWZQ1lfAUZcbgYT9AyQCcDgJvCrnrtziXiels-Hxol3xlkGTVHk24SvAdaSUtKQ=@rtzoeller.com>

```
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.





     


```
