[PATCH] test: checkout shouldn't say that HEAD has moved if it didn't

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

 



Signed-off-by: しらいしななこ <nanako3@xxxxxxxxxxx>
---

Quoting Junio C Hamano <gitster@xxxxxxxxx>:

> Daniel Cordero <theappleman@xxxxxxxxx> writes:
>
>> Previously, checkout would tell the user this message before moving HEAD,
>> without regard to whether the upcoming move will result in success.
>> If the move failed, this causes confusion.
>>
>> Show the message after the move, unless the move failed.
>>
>> Signed-off-by: Daniel Cordero <theappleman@xxxxxxxxx>
>
> Thanks; the patch looks obviously good.  Can we have tests?

Here is one.

 t/t7201-co.sh |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index bdb808a..ebfd34d 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -534,4 +534,12 @@ test_expect_success 'failing checkout -b should not break working tree' '
 
 '
 
+test_expect_success 'switch out of non-branch' '
+	git reset --hard master &&
+	git checkout master^0 &&
+	echo modified >one &&
+	test_must_fail git checkout renamer 2>error.log &&
+	! grep "^Previous HEAD" error.log
+'
+
 test_done

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

--
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]