mirror of
https://github.com/frej/fast-export.git
synced 2026-03-06 18:20:43 +01:00
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.
This commit is contained in:
committed by
Frej Drejhammar
parent
8b6c6e5cff
commit
8ed62c9cf7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user