git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 2/4] t7102 (reset): refactoring: don't hardcode SHA-1 in expected outputs

From
Alexey Shumkin <alex.crezoff@gmail.com>
Date
Jan 24, 2013, 09:10 UTC
Message-ID
<63637506fa940f6dd5fc050c7fccfa5ef41993dd.1359018188.git.Alex.Crezoff@gmail.com>
In-Reply-To
<cover.1359018188.git.Alex.Crezoff@gmail.com>

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

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
---
 t/t7102-reset.sh | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index b096dc8..cf492f4 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -28,7 +28,8 @@ test_expect_success 'creating initial files and commits' '
 
 	echo "1st line 2nd file" >secondfile &&
 	echo "2nd line 2nd file" >>secondfile &&
-	git commit -a -m "modify 2nd file"
+	git commit -a -m "modify 2nd file" &&
+	head5=$(git rev-parse --verify HEAD)
 '
 # git log --pretty=oneline # to see those SHA1 involved
 
@@ -56,7 +57,7 @@ test_expect_success 'giving a non existing revision should fail' '
 	test_must_fail git reset --mixed aaaaaa &&
 	test_must_fail git reset --soft aaaaaa &&
 	test_must_fail git reset --hard aaaaaa &&
-	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
+	check_changes $head5
 '
 
 test_expect_success 'reset --soft with unmerged index should fail' '
@@ -74,7 +75,7 @@ test_expect_success \
 	test_must_fail git reset --hard -- first &&
 	test_must_fail git reset --soft HEAD^ -- first &&
 	test_must_fail git reset --hard HEAD^ -- first &&
-	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
+	check_changes $head5
 '
 
 test_expect_success 'giving unrecognized options should fail' '
@@ -86,7 +87,7 @@ test_expect_success 'giving unrecognized options should fail' '
 	test_must_fail git reset --soft -o &&
 	test_must_fail git reset --hard --other &&
 	test_must_fail git reset --hard -o &&
-	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
+	check_changes $head5
 '
 
 test_expect_success \
@@ -110,7 +111,7 @@ test_expect_success \
 
 	git checkout master &&
 	git branch -D branch1 branch2 &&
-	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
+	check_changes $head5
 '
 
 test_expect_success \
@@ -133,27 +134,27 @@ test_expect_success \
 
 	git checkout master &&
 	git branch -D branch3 branch4 &&
-	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
+	check_changes $head5
 '
 
 test_expect_success \
 	'resetting to HEAD with no changes should succeed and do nothing' '
 	git reset --hard &&
-		check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
+		check_changes $head5 &&
 	git reset --hard HEAD &&
-		check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
+		check_changes $head5 &&
 	git reset --soft &&
-		check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
+		check_changes $head5 &&
 	git reset --soft HEAD &&
-		check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
+		check_changes $head5 &&
 	git reset --mixed &&
-		check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
+		check_changes $head5 &&
 	git reset --mixed HEAD &&
-		check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
+		check_changes $head5 &&
 	git reset &&
-		check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
+		check_changes $head5 &&
 	git reset HEAD &&
-		check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
+		check_changes $head5
 '
 
 >.diff_expect
@@ -176,7 +177,7 @@ test_expect_success '--soft reset only should show changes in diff --cached' '
 	git reset --soft HEAD^ &&
 	check_changes d1a4bc3abce4829628ae2dcb0d60ef3d1a78b1c4 &&
 	test "$(git rev-parse ORIG_HEAD)" = \
-			3ec39651e7f44ea531a5de18a9fa791c0fd370fc
+			$head5
 '
 
 >.diff_expect
@@ -193,7 +194,7 @@ test_expect_success \
 	git commit -a -C ORIG_HEAD &&
 	check_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d &&
 	test "$(git rev-parse ORIG_HEAD)" = \
-			3ec39651e7f44ea531a5de18a9fa791c0fd370fc
+			$head5
 '
 
 >.diff_expect
@@ -303,7 +304,7 @@ test_expect_success 'redoing the last two commits should succeed' '
 	echo "1st line 2nd file" >secondfile &&
 	echo "2nd line 2nd file" >>secondfile &&
 	git commit -a -m "modify 2nd file" &&
-	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
+	check_changes $head5
 '
 
 >.diff_expect
@@ -341,15 +342,15 @@ EOF
 test_expect_success \
 	'--hard reset to ORIG_HEAD should clear a fast-forward merge' '
 	git reset --hard HEAD^ &&
-	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
+	check_changes $head5 &&
 
 	git pull . branch1 &&
 	git reset --hard ORIG_HEAD &&
-	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
+	check_changes $head5 &&
 
 	git checkout master &&
 	git branch -D branch1 branch2 &&
-	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
+	check_changes $head5
 '
 
 cat > expect << EOF
-- 
1.8.1.1.10.g9255f3f
Previous: Alexey ShumkinNext: Junio C Hamano
Message 12 of 82 in “pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting”
  1. 1/2 pretty: Add failing tests: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Sep 20, 2011
  2. 2/2 pretty: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Sep 20, 2011
  3. Junio C HamanoSep 20, 2011
  4. Alexey ShumkinSep 20, 2011
  5. 0/4 Reroll patches against v1.8.1.1Alexey Shumkin, Jan 24, 2013
  6. 1/4 t6006 (rev-list-format): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jan 24, 2013
  7. Junio C HamanoJan 24, 2013
  8. Alexey ShumkinJan 25, 2013
  9. Alexey ShumkinJan 25, 2013
  10. Junio C HamanoJan 25, 2013
  11. Alexey ShumkinJan 25, 2013
  12. 2/4 t7102 (reset): refactoring: don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jan 24, 2013
  13. Junio C HamanoJan 24, 2013
  14. Alexey ShumkinJan 25, 2013
  15. 3/4 pretty: Add failing tests: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Jan 24, 2013
  16. Junio C HamanoJan 24, 2013
  17. Alexey ShumkinJan 25, 2013
  18. Junio C HamanoJan 24, 2013
  19. Alexey ShumkinJan 25, 2013
  20. 4/4 pretty: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Jan 24, 2013
  21. 0/5 Reroll patches against v1.8.3.1Alexey Shumkin, Jun 20, 2013
  22. 1/5 t6006 (rev-list-format): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 20, 2013
  23. Junio C HamanoJun 20, 2013
  24. 2/5 t7102 (reset): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 20, 2013
  25. 3/5 t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 20, 2013
  26. Junio C HamanoJun 20, 2013
  27. 4/5 pretty: Add failing tests: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Jun 20, 2013
  28. Junio C HamanoJun 20, 2013
  29. 5/5 pretty: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Jun 20, 2013
  30. Junio C HamanoJun 20, 2013
  31. Junio C HamanoJun 20, 2013
  32. 0/5 Reroll patches against v1.8.3.1Alexey Shumkin, Jun 25, 2013
  33. 1/5 t6006 (rev-list-format): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 25, 2013
  34. 2/5 t7102 (reset): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 25, 2013
  35. 3/5 t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 25, 2013
  36. 4/5 pretty: Add failing tests: --format output should honor logOutputEncodingAlexey Shumkin, Jun 25, 2013
  37. 5/5 pretty: --format output should honor logOutputEncodingAlexey Shumkin, Jun 25, 2013
  38. Junio C HamanoJun 25, 2013
  39. Alexey ShumkinJun 26, 2013
  40. Junio C HamanoJun 26, 2013
  41. 0/5 Reroll patches against v1.8.3.1Alexey Shumkin, Jun 26, 2013
  42. 1/5 t6006 (rev-list-format): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 26, 2013
  43. 2/5 t7102 (reset): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 26, 2013
  44. 3/5 t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 26, 2013
  45. 4/5 pretty: Add failing tests: --format output should honor logOutputEncodingAlexey Shumkin, Jun 26, 2013
  46. Johannes SixtJul 1, 2013
  47. Alexey ShumkinJul 1, 2013
  48. Johannes SixtJul 2, 2013
  49. Alexey ShumkinJul 3, 2013
  50. 5/5 pretty: --format output should honor logOutputEncodingAlexey Shumkin, Jun 26, 2013
  51. Junio C HamanoJun 26, 2013
  52. 0/5 Reroll patches against Git v1.8.3.2Alexey Shumkin, Jul 1, 2013
  53. 1/5 t6006 (rev-list-format): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jul 1, 2013
  54. 2/5 t7102 (reset): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jul 1, 2013
  55. 3/5 t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jul 1, 2013
  56. 4/5 pretty: Add failing tests: --format output should honor logOutputEncodingAlexey Shumkin, Jul 1, 2013
  57. Johannes SixtJul 2, 2013
  58. 5/5 pretty: --format output should honor logOutputEncodingAlexey Shumkin, Jul 1, 2013
  59. Junio C HamanoJul 2, 2013
  60. Alexey ShumkinJul 3, 2013
  61. Junio C HamanoJul 3, 2013
  62. 0/5 Incremental updates against 'next' branchAlexey Shumkin, Jul 4, 2013
  63. 1/5 t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1Alexey Shumkin, Jul 4, 2013
  64. Junio C HamanoJul 5, 2013
  65. Alexey ShumkinJul 5, 2013
  66. Junio C HamanoJul 5, 2013
  67. Alexey ShumkinJul 5, 2013
  68. Junio C HamanoJul 5, 2013
  69. 2/5 t4205: revert back single quotesAlexey Shumkin, Jul 4, 2013
  70. Junio C HamanoJul 5, 2013
  71. 3/5 t4205, t6006, t7102: make functions more readableAlexey Shumkin, Jul 4, 2013
  72. Junio C HamanoJul 5, 2013
  73. Alexey ShumkinJul 5, 2013
  74. Junio C HamanoJul 5, 2013
  75. Alexey ShumkinJul 5, 2013
  76. Junio C HamanoJul 5, 2013
  77. 4/5 t6006: add two more tests for the case i18n.commitEncoding is not setAlexey Shumkin, Jul 4, 2013
  78. Junio C HamanoJul 5, 2013
  79. Junio C HamanoJul 5, 2013
  80. Alexey ShumkinJul 5, 2013
  81. Junio C HamanoJul 5, 2013
  82. 5/5 t4205: avoid using `sed`Alexey Shumkin, Jul 4, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.