[PATCH v5 3/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs

2013-06-20 Thread Alexey Shumkin
The expected SHA-1 digests are always available in variables. Use
them instead of hardcoding.

Signed-off-by: Alexey Shumkin alex.crez...@gmail.com
---
 t/t4205-log-pretty-formats.sh | 48 +++
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 26fbfde..6d8d457 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -101,7 +101,11 @@ test_expect_failure 'NUL termination with --stat' '
 
 test_expect_success 'setup more commits' '
test_commit message one one one message-one 
-   test_commit message two two two message-two
+   test_commit message two two two message-two 
+   head1=$(git rev-list --max-count=1 --abbrev-commit HEAD~0) 
+   head2=$(git rev-list --max-count=1 --abbrev-commit HEAD~1) 
+   head3=$(git rev-list --max-count=1 --abbrev-commit HEAD~2) 
+   head4=$(git rev-list --max-count=1 --abbrev-commit HEAD~3)
 '
 
 test_expect_success 'left alignment formatting' '
@@ -117,18 +121,18 @@ EOF
test_cmp expected actual
 '
 
-test_expect_success 'left alignment formatting at the nth column' '
-   git log --pretty=format:%h %|(40)%s actual 
+test_expect_success 'left alignment formatting at the nth column' 
+   git log --pretty='format:%h %|(40)%s' actual 
# complete the incomplete line at the end
echo actual 
qz_to_tab_space \EOF expected 
-fa33ab1 message twoZ
-7cd6c63 message oneZ
-1711bf9 add barZ
-af20c06 initialZ
+$head1 message twoZ
+$head2 message oneZ
+$head3 add barZ
+$head4 initialZ
 EOF
test_cmp expected actual
-'
+
 
 test_expect_success 'left alignment formatting with no padding' '
git log --pretty=format:%(1)%s actual 
@@ -195,18 +199,18 @@ EOF
test_cmp expected actual
 '
 
-test_expect_success 'right alignment formatting at the nth column' '
-   git log --pretty=format:%h %|(40)%s actual 
+test_expect_success 'right alignment formatting at the nth column' 
+   git log --pretty='format:%h %|(40)%s' actual 
# complete the incomplete line at the end
echo actual 
qz_to_tab_space \EOF expected 
-fa33ab1  message two
-7cd6c63  message one
-1711bf9  add bar
-af20c06  initial
+$head1  message two
+$head2  message one
+$head3  add bar
+$head4  initial
 EOF
test_cmp expected actual
-'
+
 
 test_expect_success 'right alignment formatting with no padding' '
git log --pretty=format:%(1)%s actual 
@@ -234,18 +238,18 @@ EOF
test_cmp expected actual
 '
 
-test_expect_success 'center alignment formatting at the nth column' '
-   git log --pretty=format:%h %|(40)%s actual 
+test_expect_success 'center alignment formatting at the nth column' 
+   git log --pretty='format:%h %|(40)%s' actual 
# complete the incomplete line at the end
echo actual 
qz_to_tab_space \EOF expected 
-fa33ab1   message two  Z
-7cd6c63   message one  Z
-1711bf9 add barZ
-af20c06 initialZ
+$head1   message two  Z
+$head2   message one  Z
+$head3 add barZ
+$head4 initialZ
 EOF
test_cmp expected actual
-'
+
 
 test_expect_success 'center alignment formatting with no padding' '
git log --pretty=format:%(1)%s actual 
-- 
1.8.3.1.15.g5c23c1e

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs

2013-06-20 Thread Junio C Hamano
Alexey Shumkin alex.crez...@gmail.com writes:

 The expected SHA-1 digests are always available in variables. Use
 them instead of hardcoding.

 Signed-off-by: Alexey Shumkin alex.crez...@gmail.com
 ---
  t/t4205-log-pretty-formats.sh | 48 
 +++
  1 file changed, 26 insertions(+), 22 deletions(-)

 diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
 index 26fbfde..6d8d457 100755
 --- a/t/t4205-log-pretty-formats.sh
 +++ b/t/t4205-log-pretty-formats.sh
 @@ -101,7 +101,11 @@ test_expect_failure 'NUL termination with --stat' '
  
  test_expect_success 'setup more commits' '
   test_commit message one one one message-one 
 - test_commit message two two two message-two
 + test_commit message two two two message-two 
 + head1=$(git rev-list --max-count=1 --abbrev-commit HEAD~0) 
 + head2=$(git rev-list --max-count=1 --abbrev-commit HEAD~1) 
 + head3=$(git rev-list --max-count=1 --abbrev-commit HEAD~2) 
 + head4=$(git rev-list --max-count=1 --abbrev-commit HEAD~3)

Hmmph.  Why not rev-parse --short like in your 1/5?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html