Thread (45 messages) 45 messages, 3 authors, 2020-01-26

Re: [PATCH 05/16] t2018: don't lose return code of git commands

From: Eric Sunshine <hidden>
Date: 2019-12-27 21:43:08

On Fri, Dec 27, 2019 at 8:48 AM Denton Liu [off-list ref] wrote:
We had some git commands wrapped in non-assignment command substitutions
which would result in their return codes to be lost. Rewrite these
instances so that their return codes are now checked.
Try writing your commit messages in imperative mood:

    Fix invocations of Git commands so their exit codes are not lost
    within command substitutions...

or something. Same comment about several other commit messages in this series.

More below...
quoted hunk ↗ jump to hunk
Signed-off-by: Denton Liu <redacted>
---
diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh
@@ -23,7 +23,8 @@ do_checkout () {
        # if <sha> is not specified, use HEAD.
-       exp_sha=${2:-$(git rev-parse --verify HEAD)} &&
+       head=$(git rev-parse --verify HEAD) &&
+       exp_sha=${2:-$head} &&
Are you sure this transformation is needed? In my tests, the exit code
of the Git command is not lost.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help