From: Jacob Keller <jacob.keller@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
Jacob Keller <jacob.e.keller@intel.com>,
Git mailing list <git@vger.kernel.org>
Subject: Re: [RFC 3/3] refspec: add support for negative refspecs
Date: Fri, 21 Aug 2020 10:16:36 -0700 [thread overview]
Message-ID: <CA+P7+xrPep7caJm2uN+hAqOqZU3b2njpW95JQCzYJdKgbakp8A@mail.gmail.com> (raw)
In-Reply-To: <20200818174116.GA2473110@coredump.intra.peff.net>
On Tue, Aug 18, 2020 at 10:41 AM Jeff King <peff@peff.net> wrote:
> Hmm. I think the behavior we'd want is something like:
>
> # make sure the other side has three refs
> git branch prune/one HEAD
> git branch prune/two HEAD
> git branch prune/three HEAD
> git push dst.git refs/heads/prune/*
>
> # now drop two of ours, which are eligible for pruning
> git branch -d prune/one
> git branch -d prune/two
>
> # push with pruning, omitting "two"
> git push --prune dst.git refs/heads/prune/* ^refs/heads/prune/two
>
> # we should leave "two" but still deleted "one"
> test_write_lines one three >expect
> git -C dst.git for-each-ref --format='%(refname:lstrip=3)' refs/heads/prune/ >actual
> test_cmp expect actual
>
> I.e., the negative refspec shrinks the space we're considering pruning.
> And we'd probably want a similar test for "fetch --prune".
>
> I just tried that, though, and got an interesting result. The push
> actually complains:
>
> $ git push --prune dst.git refs/heads/prune/* ^refs/heads/prune/two
> error: src refspec refs/heads/prune/two does not match any
> error: failed to push some refs to 'dst.git'
>
> For negative refspecs, would we want to loosen the "must-exist" check?
> Or really, is this getting into the "are we negative on the src or dst"
> thing you brought up earlier? Especially with --prune, what I really
> want to say is "do not touch the remote refs/heads/two".
>
> We can get work around it by using a wildcard:
>
> $ git push --prune dst.git refs/heads/prune/* ^refs/heads/prune/two*
> To dst.git
> - [deleted] prune/one
>
> So it works as I'd expect already with your patch. But I do wonder if
> there are corner cases around the src/dst thing that might not behave
> sensibly.
>
Hmm. So this raises a good point. I added a variation of this test
where I used separate names for the source and destination. It looks
like with the current implementation, negative refspecs always apply
to the destination.
next prev parent reply other threads:[~2020-08-21 17:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-15 0:25 [RFC 1/3] refspec: fix documentation referring to refspec_item Jacob Keller
2020-08-15 0:25 ` [RFC 2/3] refspec: make sure stack refspec_item variables are zeroed Jacob Keller
2020-08-17 16:33 ` Junio C Hamano
2020-08-17 16:49 ` Jacob Keller
2020-08-15 0:25 ` [RFC 3/3] refspec: add support for negative refspecs Jacob Keller
2020-08-17 18:02 ` Jacob Keller
2020-08-17 23:43 ` Junio C Hamano
2020-08-18 0:04 ` Jacob Keller
2020-08-18 17:41 ` Jeff King
2020-08-20 23:59 ` Jacob Keller
2020-08-21 2:33 ` Jeff King
2020-08-21 16:19 ` Junio C Hamano
2020-08-21 16:28 ` Jacob Keller
2020-08-21 17:16 ` Jacob Keller [this message]
2020-08-21 17:26 ` Jacob Keller
2020-08-21 18:21 ` Jacob Keller
2020-08-21 18:59 ` Jeff King
2020-08-17 16:18 ` [RFC 1/3] refspec: fix documentation referring to refspec_item Junio C Hamano
2020-08-21 21:17 ` Jacob Keller
2020-08-21 21:41 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+P7+xrPep7caJm2uN+hAqOqZU3b2njpW95JQCzYJdKgbakp8A@mail.gmail.com \
--to=jacob.keller@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jacob.e.keller@intel.com \
--cc=peff@peff.net \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).