summaryrefslogtreecommitdiff
path: root/t/t7060-wtstatus.sh
diff options
context:
space:
mode:
authorLucien Kong <Lucien.Kong@ensimag.imag.fr>2012-06-05 22:21:26 +0200
committerJunio C Hamano <gitster@pobox.com>2012-06-14 10:15:19 -0700
commit96b0ec1a4c3cafd17bc397c9ac836950c316dab6 (patch)
tree3aa766c75682669370119da624300399d34e0e4e /t/t7060-wtstatus.sh
parent708192637e7d48bfff49c08cdd7cd6e4b052ac32 (diff)
downloadgit-96b0ec1a4c3cafd17bc397c9ac836950c316dab6.tar.gz
status: don't suggest "git rm" or "git add" if not appropriate
The display of the advice '(use git add/rm [...])' (when there are unmerged files) after running 'git status' is now depending of the mark, whether it's 'both deleted', 'deleted by us/them' or others. For instance, when there is just one file that's marked as 'both deleted', 'git status' shows '(use git rm [...])' and if there are two files, one as 'both deleted' and the other as 'added by them', the advice is '(use git add/rm [...])'. The previous tests in t7512-status-help.sh are updated. Test about the case of only 'both deleted' is added in t7060-wtstatus.sh Signed-off-by: Lucien Kong <Lucien.Kong@ensimag.imag.fr> Signed-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr> Signed-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr> Signed-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr> Signed-off-by: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7060-wtstatus.sh')
-rwxr-xr-xt/t7060-wtstatus.sh36
1 files changed, 34 insertions, 2 deletions
diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh
index e8c3690dac..f4f38a5e73 100755
--- a/t/t7060-wtstatus.sh
+++ b/t/t7060-wtstatus.sh
@@ -152,7 +152,7 @@ test_expect_success 'status when conflicts with add and rm advice (deleted by th
'
-test_expect_success 'status when conflicts with add and rm advice (both deleted)' '
+test_expect_success 'prepare for conflicts' '
git reset --hard &&
git checkout -b conflict &&
test_commit one main.txt one &&
@@ -161,7 +161,11 @@ test_expect_success 'status when conflicts with add and rm advice (both deleted)
git commit -m "main.txt renamed in sub_master.txt" &&
git checkout conflict_second &&
git mv main.txt sub_second.txt &&
- git commit -m "main.txt renamed in sub_second.txt" &&
+ git commit -m "main.txt renamed in sub_second.txt"
+'
+
+
+test_expect_success 'status when conflicts with add and rm advice (both deleted)' '
test_must_fail git merge conflict &&
cat >expected <<-\EOF &&
# On branch conflict_second
@@ -182,4 +186,32 @@ test_expect_success 'status when conflicts with add and rm advice (both deleted)
'
+test_expect_success 'status when conflicts with only rm advice (both deleted)' '
+ git reset --hard conflict_second &&
+ test_must_fail git merge conflict &&
+ git add sub_master.txt &&
+ git add sub_second.txt &&
+ cat >expected <<-\EOF &&
+ # On branch conflict_second
+ # You have unmerged paths.
+ # (fix conflicts and run "git commit")
+ #
+ # Changes to be committed:
+ #
+ # new file: sub_master.txt
+ #
+ # Unmerged paths:
+ # (use "git rm <file>..." to mark resolution)
+ #
+ # both deleted: main.txt
+ #
+ # Untracked files not listed (use -u option to show untracked files)
+ EOF
+ git status --untracked-files=no >actual &&
+ test_i18ncmp expected actual &&
+ git reset --hard &&
+ git checkout master
+'
+
+
test_done