tg.sh: handle help -h
[topgit/pro.git] / t / t2031-sequestration-commit-a.sh
blobfd34932283f7270d68d01f17d5a703a9f0c6bfae
1 #!/bin/sh
3 test_description='verify sequestration works properly with commit -a'
5 . ./test-lib.sh
7 test_plan 4
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' '
19 >"$tmp/expected" &&
20 git status --porcelain >"$tmp/actual" &&
21 test_cmp "$tmp/actual" "$tmp/expected" &&
22 printf "%s\n" "" "patch description" >>.topmsg &&
23 echo file >>file &&
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" &&
44 >"$tmp/expected" &&
45 git status --porcelain >"$tmp/actual" &&
46 test_cmp "$tmp/actual" "$tmp/expected"
49 test_done