Re: [PATCH 03/10] t0002: abstract away SHA-1-specific constants
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jun 11, 2018, 07:59 UTC
- Message-ID
- <CAPig+cSKCCzVtCqK7WctfZkc+jLUYAhDY_7L+YPkMx-3wanHHQ@mail.gmail.com>
- In-Reply-To
- <20180604235229.279814-4-sandals@crustytoothpaste.net>
On Mon, Jun 4, 2018 at 7:52 PM, brian m. carlson <sandals@crustytoothpaste.net> wrote:
Show 15 quoted lines
> Adjust the test so that it computes variables for object IDs instead of > using hard-coded hashes. > > Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> > --- > diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh > @@ -89,14 +89,16 @@ test_expect_success 'enter_repo non-strict mode' ' > cd enter_repo && > test_tick && > test_commit foo && > + git rev-parse HEAD >head-revision && > mv .git .realgit && > echo "gitdir: .realgit" >.git > ) && > + head=$(cat enter_repo/head-revision) &&
Stashing the value temporarily in a file ("head-revision") is unnecessary and somewhat ugly. Just grab it directly after the subshell exits:
(
cd enter_repo &&
...
) &&
head=$(git -C enter_repo rev-parse HEAD) &&
...