From fe7baaf8da2cab168602e51217e1587492fcdc3e Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Tue, 29 Jul 2008 14:16:07 +0200 Subject: [PATCH] show all unresolved files and some additional errors --- git-test-merge | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/git-test-merge b/git-test-merge index bd52374..bfdaee7 100755 --- a/git-test-merge +++ b/git-test-merge @@ -25,21 +25,30 @@ conflicted(){ return 0 } +fst(){ echo "$1"; } + submerge(){ while let $(( $# > 0 )); do echo "* merging with $1 "; git merge -m "${COMMIT_MESSAGE/MERGE/$name}" "$1" >> "$tmp" 2>&1 \ - || { echo "probably merge conflicts, have they all been resolved by git-rerere ?" + || { + grep ' does not point to a commit' "$tmp" && { echo ' ^^^^^^^^^^^^ '; exit 1; } + echo "probably merge conflicts, have they all been resolved by git-rerere ?" while read -er f; do echo -n "checking $f .. " - conflicted "$f" || { - echo -e "\n >> \`$f' contains unresolved conflicts, exiting" - echo " run $me c to continue, unmerged files will be git-added automatically" + if conflicted "$f"; then + echo -e "\n >> \`$f' contains unresolved conflicts" echo "$name" > "$cont"; echo "$@" >> "$cont" + conflicted=1 + else + echo "resolved" + git add "$f" + fi + [ -n "$conflicted" ] && { + echo "resolve conflicts, run $me c to continue" + echo " unmerged files will be git-added automatically" exit 1 } - echo "resolved" - git add "$f" done < <( git status | sed -n 's/#\s*unmerged:\s*\(.*\)/\1/p' ) # commit ourselves.. and continue echo "continuing" @@ -68,14 +77,16 @@ gittestmerge(){ } names=$1; if [ "$names" == "" ]; then - names="$(git config -l | sed -n "s/$me\\.\\([^=]*\\).*/\\1/p")" + names=$(fst "$(git config -l | sed -n "s/$me\\.\\([^=]*\\).*/\\1/p")") else shift fi for name in $names; do echo -e "\nupdating merge $name" set -- `git config --get "$me.$name"` - git checkout "$1" >> "$tmp" 2>&1 + git checkout "$1" >> "$tmp" 2>&1 || { + grep 'error: you need to resolve your current index first' "$tmp" && { echo ' ^^^^^^^^^^^^ '; exit 1; } + } git branch -f "$name" "$1" >> "$tmp" 2>&1; shift # setting it to the first branch, could be another one git checkout "$name" >> "$tmp" 2>&1 # try octopus first @@ -110,7 +121,7 @@ gittestmerge(){ git-test-merge (l or list) shows all defined merge sets git-test-merge (u or update) list of names - if you omit the list of names all merges will be updated + if you omit the list of names the first entry will be updated git-test-merge (c or continue) will continue merge (this name only) -- 2.11.4.GIT