{"thread":{"id":"54652","subject":"Specify resume point with git difftool?","startedAt":"2020-11-16T16:45:39Z","lastAt":"2020-11-16T19:27:04Z","messageCount":2,"participants":["Ryan Zoeller","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"410026","messageId":"gOXOaoqn-E9A2ob7ykWEcDc7ZxmSwAjcP5CCFKfr5ejCOWZQ1lfAUZcbgYT9AyQCcDgJvCrnrtziXiels-Hxol3xlkGTVHk24SvAdaSUtKQ=@rtzoeller.com","threadId":"54652","inReplyTo":null,"subject":"Specify resume point with git difftool?","fromName":"Ryan Zoeller","fromEmail":"rtzoeller@rtzoeller.com","sentAt":"2020-11-16T16:45:02Z","receivedAt":"2020-11-16T16:45:39Z","isPatch":false,"sender":{"key":"rtzoeller@rtzoeller.com","avatar":"https://avatars.githubusercontent.com/u/573497?v=4"},"body":"Hi everyone,\n\nI 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\n\ngit difftool --tool toolname main... -- *.extension\n\nFrequently 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.\n\nTypically 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.\n\nIs 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).\n\nThanks,\nRyan Zoeller\n\n"},{"id":"410036","messageId":"xmqq36199k7n.fsf@gitster.c.googlers.com","threadId":"54652","inReplyTo":"gOXOaoqn-E9A2ob7ykWEcDc7ZxmSwAjcP5CCFKfr5ejCOWZQ1lfAUZcbgYT9AyQCcDgJvCrnrtziXiels-Hxol3xlkGTVHk24SvAdaSUtKQ=@rtzoeller.com","subject":"Re: Specify resume point with git difftool?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-11-16T19:26:36Z","receivedAt":"2020-11-16T19:27:04Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ryan Zoeller <rtzoeller@rtzoeller.com> writes:\n\n> Is there a way to tell git \"resume the difftool process at file n\"?\n> The difftool prompt counts which file I'm on (\"Viewing (10/20):\n> 'filename'\"), so it seems like I ought to be able to jump ahead by\n> specifying a starting index (or range to view).\n\nThere is no such support in the code.\n\ndiff.c::run_external_diff() maitains and increments the counters\nused to show the prompt in the form of a pair of environment\nvariables, GIT_DIFF_PATH_TOTAL and GIT_DIFF_PATH_COUNTER, and they\nare used in git-difftool--helper::launch_merge_tool() when asking\nyou if you want to run the difftool backend on that 10th file out of\nthe 20 files.\n\nRight now, you can only say Yes or No to that prompt, but it\nshouldn't be too hard to add another choice to the response to the\nprompt, saying \"skip to 15th file\", for example, and record that\n\"15\" in a temporary file in $GIT_DIR/ and exit without running the\ndifftool backend on the 10th file, so that later invocation of the\ngit-difftool-helper script can skip without prompting you until it\nis the turn for 15th file.\n\nThe launch_merge_tool() function needs to be modified in the\nfollowing way to do so:\n\n - At the beginning, see if $GIT_DIR/difftool-skip-to file exists.\n\n   - If exists, read its contents.\n\n   - See if the value is larger than $GIT_DIFF_PATH_COUNTER.  If so,\n     just 'return' without doing anything else.\n\n   - Remove that file (we are at the 15th path and done skipping).\n\n - Update the \"Viewing .../ Launch?\" prompt and offer another choice\n   \"Skip to?\".\n\n - Update the if/then/fi statement that processes the answer to the\n   prompt (right now, it takes n as a sign to skip the file).  When\n   the user says \"skip to 15th\", create $GIT_DIR/difftool-skip-to\n   file and record \"15\" in it and 'return'.\n\n#leftoverbits.\n\n\n\n\n\n     \n\n"}]}