author | Junio C Hamano <gitster@pobox.com> | |
Mon, 10 Oct 2011 22:56:18 +0000 (15:56 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 10 Oct 2011 22:56:18 +0000 (15:56 -0700) |
* jm/mergetool-pathspec:
mergetool: no longer need to save standard input
mergetool: Use args as pathspec to unmerged files
mergetool: no longer need to save standard input
mergetool: Use args as pathspec to unmerged files
1 | 2 | |||
---|---|---|---|---|
Documentation/git-mergetool.txt | patch | | diff1 | | diff2 | | blob | history |
git-mergetool.sh | patch | | diff1 | | diff2 | | blob | history |
diff --combined Documentation/git-mergetool.txt
index 347091010995af95e43ced744b159b277bdb6cdc,f1f4e7a07ddd9f09aaccec9f93d14e6cc3689a0a..2a49de7cfe5188b531bc02f1115e253bfa10e0e0
SYNOPSIS
--------
+[verse]
'git mergetool' [--tool=<tool>] [-y|--no-prompt|--prompt] [<file>...]
DESCRIPTION
merge conflicts. It is typically run after 'git merge'.
If one or more <file> parameters are given, the merge tool program will
- be run to resolve differences on each file. If no <file> names are
- specified, 'git mergetool' will run the merge tool program on every file
- with merge conflicts.
+ be run to resolve differences on each file (skipping those without
+ conflicts). Specifying a directory will include all unresolved files in
+ that path. If no <file> names are specified, 'git mergetool' will run
+ the merge tool program on every file with merge conflicts.
OPTIONS
-------
diff --combined git-mergetool.sh
index b6d463f0d057361ab5909209d24fc8fd383a3dbb,0a06bde843a3a048a5276bd8d9af8accfa8f11e6..085e213a126e5864befc8e3436832ae3c587a624
--- 1/git-mergetool.sh
--- 2/git-mergetool.sh
+++ b/git-mergetool.sh
resolve_symlink_merge () {
while true; do
printf "Use (l)ocal or (r)emote, or (a)bort? "
- read ans
+ read ans || return 1
case "$ans" in
[lL]*)
git checkout-index -f --stage=2 -- "$MERGED"
else
printf "Use (c)reated or (d)eleted file, or (a)bort? "
fi
- read ans
+ read ans || return 1
case "$ans" in
[mMcC]*)
git add -- "$MERGED"
resolve_submodule_merge () {
while true; do
printf "Use (l)ocal or (r)emote, or (a)bort? "
- read ans
+ read ans || return 1
case "$ans" in
[lL]*)
if ! local_present; then
describe_file "$remote_mode" "remote" "$REMOTE"
if "$prompt" = true; then
printf "Hit return to start merge resolution tool (%s): " "$merge_tool"
- read ans
+ read ans || return 1
fi
if base_present; then
prompt_after_failed_merge() {
while true; do
printf "Continue merging other unresolved paths (y/n) ? "
- read ans
+ read ans || return 1
case "$ans" in
[yY]*)
last_status=0
rollup_status=0
- rerere=false
-
- files_to_merge() {
- if test "$rerere" = true
- then
- git rerere remaining
- else
- git ls-files -u | sed -e 's/^[^ ]* //' | sort -u
- fi
- }
-
+ files=
if test $# -eq 0 ; then
cd_to_toplevel
if test -e "$GIT_DIR/MERGE_RR"
then
- rerere=true
- fi
-
- files=$(files_to_merge)
- if test -z "$files" ; then
- echo "No files need merging"
- exit 0
+ files=$(git rerere remaining)
+ else
+ files=$(git ls-files -u | sed -e 's/^[^ ]* //' | sort -u)
fi
+ else
+ files=$(git ls-files -u -- "$@" | sed -e 's/^[^ ]* //' | sort -u)
+ fi
- # Save original stdin
- exec 3<&0
+ if test -z "$files" ; then
+ echo "No files need merging"
+ exit 0
+ fi
- printf "Merging:\n"
- printf "$files\n"
+ printf "Merging:\n"
+ printf "$files\n"
- files_to_merge |
- while IFS= read i
- do
- if test $last_status -ne 0; then
- prompt_after_failed_merge <&3 || exit 1
- fi
- printf "\n"
- merge_file "$i" <&3
- last_status=$?
- if test $last_status -ne 0; then
- rollup_status=1
- fi
- done
- else
- while test $# -gt 0; do
- if test $last_status -ne 0; then
- prompt_after_failed_merge || exit 1
- fi
- printf "\n"
- merge_file "$1"
- last_status=$?
- if test $last_status -ne 0; then
- rollup_status=1
- fi
- shift
- done
- fi
+ IFS='
+ '
+ for i in $files
+ do
+ if test $last_status -ne 0; then
+ prompt_after_failed_merge || exit 1
+ fi
+ printf "\n"
+ merge_file "$i"
+ last_status=$?
+ if test $last_status -ne 0; then
+ rollup_status=1
+ fi
+ done
exit $rollup_status