[PATCH/RFC] t7512-status-warnings.sh : better advices for git status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tests for the display of 'git status' before and after a conflict
resolved, and after a conflict warning during a rebase.

Signed-off-by: Kong Lucien <Lucien.Kong@xxxxxxxxxxxxxxx>
---
The three following tests are supposed to be successful
but are not currently as we are not sure about the implementation.
For example, should the warning messages be in the top header of 'git status' or after that ?
If the warning messages are put as in the following tests,
we will have to code the messages in remote.c, and not in wt-status.c.

We are also working on the same kind of messages for git am and bisect.

 git/t/t7512-status-warnings.sh |   96 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 96 insertions(+), 0 deletions(-)
 create mode 100755 git/t/t7512-status-warnings.sh

diff --git a/git/t/t7512-status-warnings.sh b/git/t/t7512-status-warnings.sh
new file mode 100755
index 0000000..0214348
--- /dev/null
+++ b/git/t/t7512-status-warnings.sh
@@ -0,0 +1,96 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Valentin Duperray, Lucien Kong, Franck Jonas,
+#		     Thomas Nguy, Khoi Nguyen
+#		     Grenoble INP Ensimag
+#
+
+test_description='git status advices'
+
+. ./test-lib.sh
+
+test_expect_success 'status when conflicts unresolved' '
+	git init --shared --bare conflict_test.git &&
+	git clone conflict_test.git test1 &&
+	git clone conflict_test.git test2 &&
+	cd ./test1 &&
+	test_commit A main.txt toto &&
+	cd ../test2 &&
+	test_commit B main.txt tata &&
+	git push --all &&
+	cd ../test1 &&
+	test_must_fail git pull &&
+	cat >expect <<-\EOF &&
+	# On branch master
+	# Your branch and '\''origin/master'\'' have diverged,
+	# and have 1 and 1 different commit each, respectively.
+	# You have unmerged paths : fix conflicts and then commit the result.
+	#
+	# Unmerged paths:
+	#   (use "git add/rm <file>..." as appropriate to mark resolution)
+	#
+	#	both added:         main.txt
+	#
+	# Untracked files:
+	#   (use "git add <file>..." to include in what will be committed)
+	#
+	#	expect
+	#	output
+	no changes added to commit (use "git add" and/or "git commit -a")
+	EOF
+	git status >output &&
+	test_cmp expect output
+'
+
+
+test_expect_success 'status when conflicts resolved before commit' '
+	echo toto > main.txt &&
+	git add main.txt &&
+	cat >expect <<-\EOF &&
+	# On branch master
+	# Your branch and '\''origin/master'\'' have diverged,
+	# and have 1 and 1 different commit each, respectively.
+	# You are still merging, commit to end merge.
+	#
+	# Untracked files:
+	#   (use "git add <file>..." to include in what will be committed)
+	#
+	#	expect
+	#	output
+	nothing added to commit but untracked files present (use "git add" to track)
+	EOF
+	git status >output &&
+	test_cmp expect output
+'
+
+
+
+
+test_expect_success 'status when rebase in progress' '
+	git commit -m "one" &&
+	test_commit two main.txt tata &&
+	test_commit three main.txt titi &&
+	test_must_fail git rebase HEAD^ --onto HEAD^^ &&
+	cat >expect <<-\EOF &&
+	# Not currently on any branch.
+	# You are currently rebasing : fix conflicts and then run "git rebase -- continue".
+	# If you would prefer to skip this patch, instead run "git rebase --skip".
+	# To check out  the original branch and stop rebasing run "git rebase --abort".
+	# Unmerged paths:
+	#   (use "git reset HEAD <file>..." to unstage)
+	#   (use "git add/rm <file>..." as appropriate to mark resolution)
+	#
+	#	both modified:      main.txt
+	#
+	# Untracked files:
+	#   (use "git add <file>..." to include in what will be committed)
+	#
+	#	expect
+	#	output
+	no changes added to commit (use "git add" and/or "git commit -a")
+	EOF
+	git status >output &&
+	test_cmp expect output
+'
+
+test_done
-- 
1.7.8

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]