diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-10-10 15:56:18 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-10 15:56:18 -0700 |
commit | 5fbdb9c2e8cc7226d9a9e7de5ad09ac5f0a0b906 (patch) | |
tree | 76972a1c5eebdc2ade46704ac95b04c712e5321b /git-mergetool.sh | |
parent | 7ddd582402aa926d5ec33d914ccc8bfaf1b15c06 (diff) | |
parent | 6d9990a959c0168ab6dfe75236980f95ac512ce5 (diff) | |
download | git-5fbdb9c2e8cc7226d9a9e7de5ad09ac5f0a0b906.tar.gz |
Merge branch 'jm/mergetool-pathspec'
* jm/mergetool-pathspec:
mergetool: no longer need to save standard input
mergetool: Use args as pathspec to unmerged files
Diffstat (limited to 'git-mergetool.sh')
-rwxr-xr-x | git-mergetool.sh | 76 |
1 files changed, 27 insertions, 49 deletions
diff --git a/git-mergetool.sh b/git-mergetool.sh index b6d463f0d0..085e213a12 100755 --- a/git-mergetool.sh +++ b/git-mergetool.sh @@ -342,64 +342,42 @@ merge_keep_temporaries="$(git config --bool mergetool.keepTemporaries || echo fa 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 |