From: Kyle J. McKay Date: Sat, 15 Mar 2014 04:02:26 +0000 (-0700) Subject: hg-fast-export.sh: Do not ignore hg-fast-export.py exit code X-Git-Url: http://crossforests.com/gitweb?a=commitdiff_plain;h=8ed62c9cf7d6b97b193191e495162af994796355;p=python%2Ffast-export.git hg-fast-export.sh: Do not ignore hg-fast-export.py exit code Originally 9643aa5d did this by using a bashism even though the /bin/sh interpreter is being used. Then ea55929e attempted to compensate for this by disabling the bashism when the interpreter was not actually bash which results in the hg-fast-export.py exit code still being ignored in that case. Instead check the error code without requiring a bashism. --- diff --git a/hg-fast-export.sh b/hg-fast-export.sh index 6adbab0..f6565d0 100755 --- a/hg-fast-export.sh +++ b/hg-fast-export.sh @@ -81,14 +81,32 @@ fi # cleanup on exit trap 'rm -f "$GIT_DIR/$PFX-$SFX_MARKS.old" "$GIT_DIR/$PFX-$SFX_MARKS.tmp"' 0 -GIT_DIR="$GIT_DIR" $PYTHON "$ROOT/hg-fast-export.py" \ - --repo "$REPO" \ - --marks "$GIT_DIR/$PFX-$SFX_MARKS" \ - --mapping "$GIT_DIR/$PFX-$SFX_MAPPING" \ - --heads "$GIT_DIR/$PFX-$SFX_HEADS" \ - --status "$GIT_DIR/$PFX-$SFX_STATE" \ - "$@" \ -| git fast-import $GFI_OPTS --export-marks="$GIT_DIR/$PFX-$SFX_MARKS.tmp" || exit 1 +_err1= +_err2= +exec 3>&1 +{ read -r _err1 || :; read -r _err2 || :; } <<-EOT +$( + exec 4>&3 3>&1 1>&4 4>&- + { + _e1=0 + GIT_DIR="$GIT_DIR" $PYTHON "$ROOT/hg-fast-export.py" \ + --repo "$REPO" \ + --marks "$GIT_DIR/$PFX-$SFX_MARKS" \ + --mapping "$GIT_DIR/$PFX-$SFX_MAPPING" \ + --heads "$GIT_DIR/$PFX-$SFX_HEADS" \ + --status "$GIT_DIR/$PFX-$SFX_STATE" \ + "$@" 3>&- || _e1=$? + echo $_e1 >&3 + } | \ + { + _e2=0 + git fast-import $GFI_OPTS --export-marks="$GIT_DIR/$PFX-$SFX_MARKS.tmp" 3>&- || _e2=$? + echo $_e2 >&3 + } +) +EOT +exec 3>&- +[ "$_err1" = 0 -a "$_err2" = 0 ] || exit 1 # move recent marks cache out of the way... if [ -f "$GIT_DIR/$PFX-$SFX_MARKS" ] ; then