Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Sverre Rabbelier <srabbelier@gmail.com>
Cc: Jakub Narebski <jnareb@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Git List <git@vger.kernel.org>
Subject: Re: [RFC PATCH 1/2] add a --delete option to git push
Date: Fri, 14 Aug 2009 01:21:53 -0400	[thread overview]
Message-ID: <20090814052153.GA2881@coredump.intra.peff.net> (raw)
In-Reply-To: <1250226349-20397-2-git-send-email-srabbelier@gmail.com>

On Thu, Aug 13, 2009 at 10:05:48PM -0700, Sverre Rabbelier wrote:

> Those new to git have a hard time learning how to delete a remote
> ref. This makes it easier for them to find out how by providing a
> flag to git push.

Should this also impact refs read from the config? E.g., if I do "git
push --delete" will it try to impact matching refs (which is almost
certainly a mistake), or refs I have in my remote.$X.push (which is
probably also a mistake)?

>From reading your patch, it looks like it just touches the command-line.
I think that's the right thing to do, but I think it makes sense to
think half a second to make sure.

And with the way you have it, "git push --delete" will silently ignore
the --delete and push configured refspecs. Probably it should say
"--delete is useless without refspecs on the command line".

>     Currently `git push --delete master:master` results in a somewhat
>     cryptic error message. It seems unlikely however, that those new
>     to git would use the 'old:new' notation, so I haven't bothered
>     guarding against it and settled for documenting it.

It seems like it would be simple enough to just check whether the
refspec contains a colon; if so, silently leave it alone. That could
also protect configured refspecs, as mentioned above, but I wouldn't
rule out somebody have a single-name refspec in their config (in fact, I
think "remote.$X.push = HEAD" is reasonable -- should that delete the
HEAD on "git push --delete"?).

> +--delete::
> +    Delete the specified refs. Prefixes all refs with ':' to tell the
> +    push machinery to delete the specified ref. As such, the refs
> +    that are to be deleted should not contain a ':' specifier.
> +

This impacts _all_ refspecs. Remember that we can have multiple refspecs
on the command-line. So I can "move" a ref remotely with:

  git push :old-name old-name:new-name

but I can't do:

  git push --delete old-name old-name:new-name

Ignoring colon-less refspecs would make that work, but would not allow
the similar:

  # branch has already been renamed to new-name locally
  git push --delete old-name new-name

So maybe it would make more sense for it to be "--delete <ref>" and
impact only a single ref. The simple case of "git push --delete foo"
would remain unchanged.

The counter-argument is that "--delete" does not necessarily need to be
as powerful as the ":ref" syntax, but I don't see the downside in making
it so.

-Peff

  parent reply	other threads:[~2009-08-14  5:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-14  5:05 [RFC PATCH 0/2] add a --delete option to git push Sverre Rabbelier
2009-08-14  5:05 ` [RFC PATCH 1/2] " Sverre Rabbelier
2009-08-14  5:05   ` [RFC PATCH 2/2] test that git push --delete deletes the remote ref Sverre Rabbelier
2009-08-14  5:21   ` Jeff King [this message]
2009-08-14  6:24     ` [RFC PATCH 1/2] add a --delete option to git push Sverre Rabbelier
2009-08-14  6:33       ` Jeff King
2009-08-14  6:40         ` Sverre Rabbelier
2009-08-14  6:55           ` Jeff King
2009-08-14  6:53   ` Junio C Hamano
2009-08-14  7:00     ` Jeff King
2009-08-14  7:01       ` Jeff King
2009-08-14  7:05     ` Sverre Rabbelier
2009-08-14  7:51     ` Junio C Hamano
2009-08-15  2:01       ` Junio C Hamano
2009-08-16  2:30         ` Sverre Rabbelier
2009-08-16  9:19         ` Jakub Narebski
2009-08-14  8:50 ` [RFC PATCH 0/2] " Jakub Narebski
     [not found]   ` <fabb9a1e0908140953w2d3f571cv3e7415817c2758a7@mail.gmail.com>
2009-08-14 20:25     ` Jakub Narebski

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=20090814052153.GA2881@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jnareb@gmail.com \
    --cc=srabbelier@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox