From: Jeff King <peff@peff.net>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>,
Git mailing list <git@vger.kernel.org>
Subject: Re: [PATCH] branch -l: print useful info whilst rebasing a non-local branch
Date: Sun, 25 Mar 2018 00:33:37 -0400 [thread overview]
Message-ID: <20180325043337.GA32465@sigill.intra.peff.net> (raw)
In-Reply-To: <CAPig+cRe9AmFv=GCxPOo5vcLGFuT1qdM60M4KV5P6UN+Ai-QoQ@mail.gmail.com>
On Sun, Mar 25, 2018 at 12:28:30AM -0400, Eric Sunshine wrote:
> On Sun, Mar 25, 2018 at 12:10 AM, Jeff King <peff@peff.net> wrote:
> > Alternatively, we could at least detect the situation that confused you:
> >
> > diff --git a/builtin/branch.c b/builtin/branch.c
> > @@ -676,6 +676,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
> > + if (list && reflog)
> > + die(_("--reflog in list mode does not make sense"));
> > +
> >
> > That doesn't help somebody mistakenly doing "git branch -l foo", but
> > more likely they'd do "git branch -l jk/*" if they were trying to list
> > branches (and then "branch" would barf with "that's not a valid branch
> > name", though that may still leave them quite confused).
>
> Assuming that existing clients of "-l" (if there are any) only invoke
> "git branch -l <name>" to create a new branch, then it would be
> possible to interpret "-l" as --list when <name> is an existing
> branch. That is, the "-l" in "git branch -l" and "git branch -l
> <existing-branch>..." is recognized as --list, and (for backward
> compatibility only) the "-l" in "git branch -l <new-branch>" is still
> recognized as --create-reflog.
>
> This idea falls flat, however, if there are clients out there which
> actually depend upon "git branch -l <existing-branch>" failing.
I agree that might work most of the time as a sort of "do what I mean",
but I'd prefer to avoid those kinds of magic rules if we can. They're
very hard to explain to the user, and can be quite baffling when they go
wrong.
IMHO we should do one of:
1. Nothing. ;)
2. Complain about "-l" in list mode to help educate users about the
current craziness.
3. Drop "-l" (probably with a deprecation period); it seems unlikely
to me that anybody uses it for branch creation, and this would at
least reduce the confusion (then it would just be "so why don't we
have -l" instead of "why is -l not what I expect").
4. Repurpose "-l" as a shortcut for --list (also after a deprecation
period). This is slightly more dangerous in that it may confuse
people using multiple versions of Git that cross the deprecation
line. But that's kind of what the deprecation period is for...
-Peff
next prev parent reply other threads:[~2018-03-25 4:33 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-24 18:38 [PATCH] branch -l: print useful info whilst rebasing a non-local branch Kaartic Sivaraam
2018-03-25 1:34 ` Eric Sunshine
2018-03-25 3:41 ` Kaartic Sivaraam
2018-03-25 4:10 ` Jeff King
2018-03-25 4:13 ` Eric Sunshine
2018-03-25 4:28 ` Eric Sunshine
2018-03-25 4:33 ` Jeff King [this message]
2018-03-25 6:54 ` Kaartic Sivaraam
2018-03-25 7:15 ` Jacob Keller
2018-03-26 7:25 ` Jeff King
2018-03-26 7:26 ` [PATCH 1/5] t3200: unset core.logallrefupdates when testing reflog creation Jeff King
2018-03-26 7:26 ` [PATCH 2/5] t: switch "branch -l" to "branch --create-reflog" Jeff King
2018-03-26 7:28 ` [PATCH 3/5] branch: deprecate "-l" option Jeff King
2018-03-26 7:29 ` [PATCH 4/5] branch: drop deprecated " Jeff King
2018-03-26 7:29 ` [PATCH 5/5] branch: make "-l" a synonym for "--list" Jeff King
2018-03-26 7:44 ` [PATCH] branch -l: print useful info whilst rebasing a non-local branch Eric Sunshine
2018-03-26 18:38 ` Jacob Keller
2018-03-25 17:06 ` Junio C Hamano
2018-03-25 5:48 ` Eric Sunshine
2018-03-25 7:36 ` Kaartic Sivaraam
2018-04-03 4:31 ` [PATCH v2 1/2] branch --list: print useful info whilst interactive rebasing a detached HEAD Kaartic Sivaraam
2018-04-03 4:31 ` [PATCH v2 2/2] t3200: verify "branch --list" sanity when rebasing from " Kaartic Sivaraam
2018-04-03 8:00 ` Eric Sunshine
2018-04-03 12:58 ` Kaartic Sivaraam
2018-04-03 14:47 ` [PATCH v3 " Kaartic Sivaraam
2018-04-04 8:09 ` Eric Sunshine
2018-04-03 5:02 ` [PATCH v2 0/2] branch --list: print useful info whilst interactive rebasing a " Kaartic Sivaraam
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=20180325043337.GA32465@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=kaartic.sivaraam@gmail.com \
--cc=sunshine@sunshineco.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;
as well as URLs for NNTP newsgroup(s).