t3905: abstract away SHA-1-specific constants

Adjust the test so that it computes variables for blobs instead of using hard-coded hashes. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed May 21, 2018 at 02:01 UTC f1aae0346a3b9b0ba82a3054d776486823296237
1 file changed +7 -4
t/t3905-stash-include-untracked.sh
+7 -4
@@ -35,24 +35,26 @@ test_expect_success 'stash save --include-untracked cleaned the untracked files'
35 test_cmp expect actual
36 '
37
38 +tracked=$(git rev-parse --short $(echo 1 | git hash-object --stdin))
39 +untracked=$(git rev-parse --short $(echo untracked | git hash-object --stdin))
40 cat > expect.diff <<EOF
41 diff --git a/HEAD b/HEAD
42 new file mode 100644
41 -index 0000000..d00491f
43 +index 0000000..$tracked
44 --- /dev/null
45 +++ b/HEAD
46 @@ -0,0 +1 @@
47 +1
48 diff --git a/file2 b/file2
49 new file mode 100644
48 -index 0000000..d00491f
50 +index 0000000..$tracked
51 --- /dev/null
52 +++ b/file2
53 @@ -0,0 +1 @@
54 +1
55 diff --git a/untracked/untracked b/untracked/untracked
56 new file mode 100644
55 -index 0000000..5a72eb2
57 +index 0000000..$untracked
58 --- /dev/null
59 +++ b/untracked/untracked
60 @@ -0,0 +1 @@
@@ -109,10 +111,11 @@ test_expect_success 'stash save -u dirty index' '
111 git stash -u
112 '
113
114 +blob=$(git rev-parse --short $(echo 4 | git hash-object --stdin))
115 cat > expect <<EOF
116 diff --git a/file3 b/file3
117 new file mode 100644
115 -index 0000000..b8626c4
118 +index 0000000..$blob
119 --- /dev/null
120 +++ b/file3
121 @@ -0,0 +1 @@