Re: [PATCH v2 17/28] t4014: abstract away SHA-1-specific constants
On Sun, May 13, 2018 at 09:34:03AM +0200, Johannes Sixt wrote: > Am 13.05.2018 um 04:24 schrieb brian m. carlson: > > diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh > > index dac3f349a3..42b3e11207 100755 > > --- a/t/t4014-format-patch.sh > > +++ b/t/t4014-format-patch.sh > > @@ -578,7 +578,9 @@ test_expect_success 'excessive subject' ' > > rm -rf patches/ && > > git checkout side && > > + before=$(git rev-parse --short $(git hash-object file)) && > > for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >>file && > > + after=$(git rev-parse --short $(git hash-object file)) && > > It would be better to avoid process expansion in command arguments, because > the shell does not diagnose failures. This is preferable: > > before=$(git hash-object file) && > before=$(git rev-parse --short $before) && I considered that and assumed it would be all right because if git hash-object failed, we wouldn't get anything on stdout. However, I agree that your approach is more robust, so I'll reroll with that change. -- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204 signature.asc Description: PGP signature
Re: [PATCH v2 17/28] t4014: abstract away SHA-1-specific constants
Am 13.05.2018 um 04:24 schrieb brian m. carlson: Adjust the test so that it computes values for blobs instead of using hard-coded hashes. Signed-off-by: brian m. carlson--- t/t4014-format-patch.sh | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index dac3f349a3..42b3e11207 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -578,7 +578,9 @@ test_expect_success 'excessive subject' ' rm -rf patches/ && git checkout side && + before=$(git rev-parse --short $(git hash-object file)) && for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >>file && + after=$(git rev-parse --short $(git hash-object file)) && It would be better to avoid process expansion in command arguments, because the shell does not diagnose failures. This is preferable: before=$(git hash-object file) && before=$(git rev-parse --short $before) && -- Hannes
[PATCH v2 17/28] t4014: abstract away SHA-1-specific constants
Adjust the test so that it computes values for blobs instead of using hard-coded hashes. Signed-off-by: brian m. carlson--- t/t4014-format-patch.sh | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index dac3f349a3..42b3e11207 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -578,7 +578,9 @@ test_expect_success 'excessive subject' ' rm -rf patches/ && git checkout side && + before=$(git rev-parse --short $(git hash-object file)) && for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >>file && + after=$(git rev-parse --short $(git hash-object file)) && git update-index file && git commit -m "This is an excessively long subject line for a message due to the habit some projects have of not having a short, one-line subject at the start of the commit message, but rather sticking a whole paragraph right at the start as the only thing in the commit message. It had better not become the filename for the patch." && git format-patch -o patches/ master..side && @@ -586,7 +588,6 @@ test_expect_success 'excessive subject' ' ' test_expect_success 'cover-letter inherits diff options' ' - git mv file foo && git commit -m foo && git format-patch --no-renames --cover-letter -1 && @@ -616,7 +617,7 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' ' ' cat > expect << EOF -index 40f36c6..2dc5c23 100644 +index $before..$after 100644 --- a/file +++ b/file @@ -13,4 +13,20 @@ C @@ -640,7 +641,7 @@ test_expect_success 'format-patch respects -U' ' cat > expect << EOF diff --git a/file b/file -index 40f36c6..2dc5c23 100644 +index $before..$after 100644 --- a/file +++ b/file @@ -14,3 +14,19 @@ C