Re: [PATCH v4 12/39] t7201: abstract away SHA-1-specific constants
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jul 26, 2020, 22:54 UTC
- Message-ID
- <CAPig+cQcK9t6fo7xZc03VCpdSfVmP+5NKjZgvshkLP74B6-ysQ@mail.gmail.com>
- In-Reply-To
- <20200726195424.626969-13-sandals@crustytoothpaste.net>
On Sun, Jul 26, 2020 at 3:55 PM brian m. carlson <sandals@crustytoothpaste.net> wrote:
Show 14 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/t7201-co.sh b/t/t7201-co.sh > @@ -230,9 +230,10 @@ test_expect_success 'switch to another branch while carrying a deletion' ' > test_expect_success 'checkout to detach HEAD (with advice declined)' ' > git config advice.detachedHead false && > + rev=$(git rev-parse --short renamer^) && > git checkout -f renamer && git clean -f && > git checkout renamer^ 2>messages && > - test_i18ngrep "HEAD is now at 7329388" messages && > + test_i18ngrep "HEAD is now at $rev" messages &&
This test computes (and uses) the value 'rev'...
> @@ -250,7 +251,7 @@ test_expect_success 'checkout to detach HEAD' ' > GIT_TEST_GETTEXT_POISON=false git checkout renamer^ 2>messages && > - grep "HEAD is now at 7329388" messages && > + grep "HEAD is now at $rev" messages &&
... and then this separate test re-uses that value, which unnecessarily couples these tests tightly. How about instead just re-computing the value of 'rev' in the second test, which will make it easier to run individual tests while skipping others.