All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.keller@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Jacob Keller <jacob.keller@gmail.com>
Subject: [PATCH v3 6/6] remote: add test for negative refspec with prune
Date: Thu, 16 Jun 2022 17:20:36 -0700	[thread overview]
Message-ID: <20220617002036.1577-7-jacob.keller@gmail.com> (raw)
In-Reply-To: <20220617002036.1577-1-jacob.keller@gmail.com>

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@gmail.com>
---
 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


      parent reply	other threads:[~2022-06-17  0:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17  0:20 [PATCH v3 0/6] remote: handle negative refspecs with show Jacob Keller
2022-06-17  0:20 ` [PATCH v3 1/6] remote: handle negative refspecs in git remote show Jacob Keller
2022-06-17  0:20 ` [PATCH v3 2/6] t5505: remove sub shell use in favor of git -C Jacob Keller
2022-06-17  0:20 ` [PATCH v3 3/6] tests: handle --global directly in test_config/test_unconfig Jacob Keller
2022-06-17  0:20 ` [PATCH v3 4/6] tests: only automatically unset matching values from test_config Jacob Keller
2022-06-17  0:20 ` [PATCH v3 5/6] t5505: use test_config where appropriate Jacob Keller
2022-06-17  0:20 ` Jacob Keller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220617002036.1577-7-jacob.keller@gmail.com \
    --to=jacob.keller@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.