mirror of
https://github.com/git/git
synced 2024-11-05 18:59:29 +00:00
t2018: don't lose return code of git commands
Fix invocations of git commands so their exit codes are not lost within non-assignment command substitutions. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
30c0367668
commit
62e80fcb48
1 changed files with 8 additions and 3 deletions
|
@ -41,8 +41,12 @@ do_checkout () {
|
||||||
test_must_fail git checkout $opts $exp_branch $exp_sha
|
test_must_fail git checkout $opts $exp_branch $exp_sha
|
||||||
else
|
else
|
||||||
git checkout $opts $exp_branch $exp_sha &&
|
git checkout $opts $exp_branch $exp_sha &&
|
||||||
test $exp_ref = $(git rev-parse --symbolic-full-name HEAD) &&
|
echo "$exp_ref" >ref.expect &&
|
||||||
test $exp_sha = $(git rev-parse --verify HEAD)
|
git rev-parse --symbolic-full-name HEAD >ref.actual &&
|
||||||
|
test_cmp ref.expect ref.actual &&
|
||||||
|
echo "$exp_sha" >sha.expect &&
|
||||||
|
git rev-parse --verify HEAD >sha.actual &&
|
||||||
|
test_cmp sha.expect sha.actual
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +166,8 @@ test_expect_success 'checkout -B to a merge base' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'checkout -B to an existing branch from detached HEAD resets branch to HEAD' '
|
test_expect_success 'checkout -B to an existing branch from detached HEAD resets branch to HEAD' '
|
||||||
git checkout $(git rev-parse --verify HEAD) &&
|
head=$(git rev-parse --verify HEAD) &&
|
||||||
|
git checkout "$head" &&
|
||||||
|
|
||||||
do_checkout branch2 "" -B
|
do_checkout branch2 "" -B
|
||||||
'
|
'
|
||||||
|
|
Loading…
Reference in a new issue