Re: [PATCH] mergetool: Use args as pathspec to unmerged files
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 16, 2011, 20:17 UTC
- Message-ID
- <7vaaa4fdix.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <C5AD8BFC-DA48-4CE9-B821-D0076825F33C@JonathonMah.com>
Jonathon Mah <me@JonathonMah.com> writes:
Show 11 quoted lines
> Mergetool now treats its path arguments as a pathspec (like other git > subcommands), restricting action to the given files and directories. > Files matching the pathspec are filtered so mergetool only acts on > unmerged paths; previously it would assume each path argument was in an > unresolved state, and get confused when it couldn't check out their > other stages. > > Running "git mergetool subdir" will prompt to resolve all conflicted > blobs under subdir. > > Signed-off-by: Jonathon Mah <me@JonathonMah.com>
It looks like this simplifies the code quote a bit and make the result easier to follow ;-) Nicely done.
As nobody reads from a pipe in while loop and runs merge_file or prompt inside, there no longer is a reason to redirect the original standard input and make it available, hence we could perhaps add this patch on top of your change.
Ack from mergetool/difftool folks?
Thanks.
git-mergetool.sh | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/git-mergetool.sh b/git-mergetool.sh index 83551c7..0a06bde 100755 --- a/git-mergetool.sh +++ b/git-mergetool.sh @@ -362,20 +362,18 @@ if test -z "$files" ; then exit 0 fi -# Save original stdin -exec 3<&0 - printf "Merging:\n" printf "$files\n" IFS=' -'; for i in $files +' +for i in $files do if test $last_status -ne 0; then - prompt_after_failed_merge <&3 || exit 1 + prompt_after_failed_merge || exit 1 fi printf "\n" - merge_file "$i" <&3 + merge_file "$i" last_status=$? if test $last_status -ne 0; then rollup_status=1