Skip to content

Commit 87d38af

Browse files
peffgitster
authored andcommitted
t5551: simplify expected cookie file
After making an HTTP request that should store cookies, we check that the expected values are in the cookie file. We don't want to look at the whole file, because it has noisy comments at the top that we shouldn't depend on. But we strip out the interesting bits using "tail -3", which is brittle. It requires us to put an extra blank line in our expected output, and it would fail to notice any reordering or extra content in the cookie file. Instead, let's just grep for non-blank lines that are not comments, which more directly describes what we're interested in. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 795d713 commit 87d38af

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

t/t5551-http-fetch-smart.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set
294294
127.0.0.1 FALSE /smart_cookies/ FALSE 0 othername othervalue
295295
EOF
296296
sort >expect_cookies.txt <<-\EOF &&
297-
298297
127.0.0.1 FALSE /smart_cookies/ FALSE 0 othername othervalue
299298
127.0.0.1 FALSE /smart_cookies/repo.git/info/ FALSE 0 name value
300299
EOF
@@ -306,8 +305,8 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set
306305
# might be able to run this test in all protocol versions.
307306
if test "$GIT_TEST_PROTOCOL_VERSION" = 0
308307
then
309-
tail -3 cookies.txt | sort >cookies_tail.txt &&
310-
test_cmp expect_cookies.txt cookies_tail.txt
308+
grep "^[^#]" cookies.txt | sort >cookies_stripped.txt &&
309+
test_cmp expect_cookies.txt cookies_stripped.txt
311310
fi
312311
'
313312

0 commit comments

Comments
 (0)