3 test_description
='verify sequestration works properly with commit -a'
9 tmp
="$(test_get_temp -d cmp)" && [ -n "$tmp" ] && [ -d "$tmp" ] || die
11 test_expect_success
'setup' '
12 tg_test_setup_topgit &&
13 tg_test_create_branch t/frabjous : &&
14 git checkout -f t/frabjous &&
15 test_commit "test commit" file test
18 test_expect_success LASTOK
'modified status as expected' '
20 git status --porcelain >"$tmp/actual" &&
21 test_cmp "$tmp/actual" "$tmp/expected" &&
22 printf "%s\n" "" "patch description" >>.topmsg &&
24 printf "%s\n" " M .topmsg" " M file" >"$tmp/expected" &&
25 git status --porcelain >"$tmp/actual" &&
26 test_cmp "$tmp/actual" "$tmp/expected"
29 test_expect_success LASTOK
'commit -a sequesters .topmsg' '
30 h0="$(git rev-parse --verify HEAD --)" && test -n "$h0" &&
31 test_must_fail git commit -am test &&
32 h1="$(git rev-parse --verify HEAD --)" && test -n "$h1" &&
33 test "$h0" != "$h1" &&
34 printf "%s\n" " M file" >"$tmp/expected" &&
35 git status --porcelain >"$tmp/actual" &&
36 test_cmp "$tmp/actual" "$tmp/expected"
39 test_expect_success LASTOK
'commit once more, with feeling' '
40 h0="$(git rev-parse --verify HEAD --)" && test -n "$h0" &&
41 git commit -am test &&
42 h1="$(git rev-parse --verify HEAD --)" && test -n "$h1" &&
43 test "$h0" != "$h1" &&
45 git status --porcelain >"$tmp/actual" &&
46 test_cmp "$tmp/actual" "$tmp/expected"