[PATCH v3 6/6] remote: add test for negative refspec with prune

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

 



git remote prune does not handle negative refspecs properly. If a
negative refspec got added after a fetch, a user may expect that the
resulting refs that were previously fetched would now be considered
stale, and thus removed by git remote prune. Show that this isn't the
case with a new test case.

Signed-off-by: Jacob Keller <jacob.keller@xxxxxxxxx>
---
 t/t5505-remote.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 8cad753023ef..0810e7d8d0b7 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -399,6 +399,19 @@ test_expect_success 'prune --dry-run' '
 	test_cmp expect output
 '
 
+cat >expect <<EOF
+Pruning origin
+URL: $(pwd)/one
+ * [would prune] origin/side2
+EOF
+
+test_expect_failure 'prune --dry-run negative refspec' '
+	test_config -C test --add remote.origin.fetch ^refs/heads/side2 &&
+	git -C test remote prune --dry-run origin >output &&
+	git -C test rev-parse refs/remotes/origin/side2 &&
+	test_cmp expect output
+'
+
 test_expect_success 'add --mirror && prune' '
 	mkdir mirror &&
 	git -C mirror init --bare &&
-- 
2.36.1




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

  Powered by Linux