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

[PATCHv3 4/4] Add tests for git-status --sequencer

From
Phil Hord <hordp@cisco.com>
Date
Nov 9, 2012, 18:56 UTC
Message-ID
<1352487385-5929-5-git-send-email-hordp@cisco.com>
In-Reply-To
<1352487385-5929-1-git-send-email-hordp@cisco.com>

Add t7061-status-sequence.sh with tests for the various 'git status --sequence' states.

I did not include tests for these states because I am not sure how to induce these conditions organically yet:

   conflicted am status
   empty am status
   rebase-interactive editing status
   rebase-interactive splitting status
Signed-off-by: Phil Hord <hordp@cisco.com>
---
 t/t7061-status-sequence.sh | 96 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100755 t/t7061-status-sequence.sh
diff --git a/t/t7061-status-sequence.sh b/t/t7061-status-sequence.sh
new file mode 100755
index 0000000..db99822
--- /dev/null
+++ b/t/t7061-status-sequence.sh
@@ -0,0 +1,96 @@
+#!/bin/sh
+
+test_description='sequencer state tokens'
+
+. ./test-lib.sh
+
+expect_tokens() {
+	for TOKEN in "$@" ; do
+		echo "## $TOKEN"
+	done | sort
+}
+
+status_has_only() {
+	expect_tokens "$@" >expect &&
+	git status -S | sort >actual &&
+	test_cmp expect actual
+}
+	
+test_expect_success setup '
+	test_commit A &&
+	test_commit B oneside added &&
+	git checkout A^0 &&
+	test_commit C oneside created
+'
+
+test_expect_success 'status -S reports conflicted merge' '
+	git checkout B^0 &&
+	test_must_fail git merge C &&
+	status_has_only commit-pending conflicted merge
+'
+
+test_expect_success 'git reset --hard cleans up merge status' '
+	git reset --hard HEAD &&
+	status_has_only
+'
+
+test_expect_success 'status -S reports conflicted rebase' '
+	git reset --hard HEAD &&
+	git checkout B^0 &&
+	test_must_fail git rebase C &&
+	status_has_only conflicted rebase
+'
+
+test_expect_success 'git rebase --abort cleans up rebase status' '
+	git rebase --abort &&
+	status_has_only
+'
+
+test_expect_success 'status -S reports incomplete cherry-pick' '
+	git reset --hard HEAD &&
+	git checkout A &&
+	git cherry-pick --no-commit C &&
+	status_has_only commit-pending
+'
+
+test_expect_success 'completing commit cleans up pending commit status' '
+	git commit -mcompleted &&
+	status_has_only
+'
+
+test_expect_success 'status -S reports failed cherry-pick' '
+	git reset --hard HEAD &&
+	git checkout B &&
+	test_must_fail git cherry-pick C &&
+	status_has_only cherry-pick commit-pending conflicted
+'
+
+test_expect_success 'resolved conflicts clear conflicted status' '
+	git add oneside &&
+	status_has_only cherry-pick commit-pending
+'
+
+test_expect_success 'aborted cherry-pick clears cherry-pick status' '
+	git cherry-pick --abort &&
+	status_has_only
+'
+
+test_expect_success 'conflicted rebase-interactive status' '
+	git reset --hard HEAD &&
+	git checkout B &&
+	test_must_fail git rebase -i C &&
+	status_has_only rebase-interactive conflicted commit-pending
+'
+
+test_expect_success 'bisect status' '
+	git reset --hard HEAD &&
+	git bisect start &&
+	status_has_only bisect
+'
+
+test_expect_success 'bisect-reset clears bisect status' '
+	git bisect reset &&
+	status_has_only
+'
+
+test_done
-- 
1.8.0.3.gde9c7d5.dirty
Previous: Junio C Hamano
Message 26 of 26 in “[PATCHv2] git-status: show short sequencer state”
  1. Phil HordOct 23, 2012
  2. Phil HordOct 23, 2012
  3. Jeff KingOct 25, 2012
  4. Phil HordOct 25, 2012
  5. Phil HordOct 29, 2012
  6. Jeff KingOct 29, 2012
  7. Phil HordOct 29, 2012
  8. 0/3 git-status short sequencer state infoPhil Hord, Oct 29, 2012
  9. 1/3 Refactor print_state into get_statePhil Hord, Oct 29, 2012
  10. 2/3 wt-status: More state retrieval abstractionPhil Hord, Oct 29, 2012
  11. 3/3 git-status: show short sequencer statePhil Hord, Oct 29, 2012
  12. 0/4 git-status short sequencer state infoPhil Hord, Nov 9, 2012
  13. 1/4 Refactor print_state into get_statePhil Hord, Nov 9, 2012
  14. Ramkumar RamachandraNov 12, 2012
  15. 2/4 wt-status: Teach sequencer advice to use get_statePhil Hord, Nov 9, 2012
  16. 3/4 git-status: show short sequencer statePhil Hord, Nov 9, 2012
  17. Junio C HamanoNov 12, 2012
  18. Phil HordNov 12, 2012
  19. Phil HordNov 13, 2012
  20. Junio C HamanoNov 14, 2012
  21. Phil HordNov 14, 2012
  22. Junio C HamanoNov 14, 2012
  23. Phil HordNov 14, 2012
  24. Junio C HamanoNov 14, 2012
  25. Junio C HamanoNov 14, 2012
  26. 4/4 Add tests for git-status --sequencerPhil Hord, Nov 9, 2012

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.