diff options
author | Mathieu Lienard--Mayor <Mathieu.Lienard--Mayor@ensimag.imag.fr> | 2013-06-12 10:06:44 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-06-12 16:59:55 -0700 |
commit | 7e30944622573ebdf87beed057b098af7360234c (patch) | |
tree | f955e84c0c9f38db34106ad261a6ceaff4153354 /t/t3600-rm.sh | |
parent | 914dc0289d1df75cfa744cea8ec84cb529cbc791 (diff) | |
download | git-7e30944622573ebdf87beed057b098af7360234c.tar.gz |
rm: introduce advice.rmHints to shorten messages
Introduce advice.rmHints to choose whether to display advice or not
when git rm fails. Defaults to true, in order to preserve current behavior.
As an example, the message:
error: 'foo.txt' has changes staged in the index
(use --cached to keep the file, or -f to force removal)
would look like, with advice.rmHints=false:
error: 'foo.txt' has changes staged in the index
Signed-off-by: Mathieu Lienard--Mayor <Mathieu.Lienard--Mayor@ensimag.imag.fr>
Signed-off-by: Jorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@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/t3600-rm.sh')
-rwxr-xr-x | t/t3600-rm.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index 902993bb65..5c87b55645 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -707,6 +707,18 @@ test_expect_success 'rm files with different staged content' ' test_i18ncmp expect actual ' +test_expect_success 'rm files with different staged content without hints' ' + cat >expect <<-\EOF && + error: the following files have staged content different from both the + file and the HEAD: + bar.txt + foo.txt + EOF + echo content2 >foo.txt && + echo content2 >bar.txt && + test_must_fail git -c advice.rmhints=false rm foo.txt bar.txt 2>actual && + test_i18ncmp expect actual +' test_expect_success 'rm file with local modification' ' cat >expect <<-\EOF && @@ -720,6 +732,15 @@ test_expect_success 'rm file with local modification' ' test_i18ncmp expect actual ' +test_expect_success 'rm file with local modification without hints' ' + cat >expect <<-\EOF && + error: the following file has local modifications: + bar.txt + EOF + echo content4 >bar.txt && + test_must_fail git -c advice.rmhints=false rm bar.txt 2>actual && + test_i18ncmp expect actual +' test_expect_success 'rm file with changes in the index' ' cat >expect <<-\EOF && @@ -734,6 +755,14 @@ test_expect_success 'rm file with changes in the index' ' test_i18ncmp expect actual ' +test_expect_success 'rm file with changes in the index without hints' ' + cat >expect <<-\EOF && + error: the following file has changes staged in the index: + foo.txt + EOF + test_must_fail git -c advice.rmhints=false rm foo.txt 2>actual && + test_i18ncmp expect actual +' test_expect_success 'rm files with two different errors' ' cat >expect <<-\EOF && |