From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "SZEDER Gábor" <szeder@ira.uka.de>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
git@vger.kernel.org
Subject: Re: [PATCH 1/2] reflog: make the 'show' subcommand really the default
Date: Tue, 20 Apr 2010 07:37:36 -0400 [thread overview]
Message-ID: <20100420113736.GA22907@coredump.intra.peff.net> (raw)
In-Reply-To: <7veiiblzn9.fsf@alter.siamese.dyndns.org>
On Mon, Apr 19, 2010 at 05:46:02PM -0700, Junio C Hamano wrote:
> SZEDER Gábor <szeder@ira.uka.de> writes:
>
> > diff --git a/builtin/reflog.c b/builtin/reflog.c
> > index 64e45bd..d4d4409 100644
> > --- a/builtin/reflog.c
> > +++ b/builtin/reflog.c
> > @@ -712,6 +712,5 @@ int cmd_reflog(int argc, const char **argv, const char *prefix)
> > if (!strcmp(argv[1], "delete"))
> > return cmd_reflog_delete(argc - 1, argv + 1, prefix);
> >
> > - /* Not a recognized reflog command..*/
> > - usage(reflog_usage);
> > + return cmd_log_reflog(argc, argv, prefix);
>
> I am not convinced that this is a good change.
>
> It may be that show/expire/delete happens to be the _only_ subcommands
> today, but if we had this patch, the command will change the behaviour
> when we add a new subcommand (the name of that subcommand may happen to be
> also a refname).
I don't think it is that big a deal. Scripts should always use the
explicit "git reflog show <ref>" form, which will remain safe. "git
reflog <ref>" is handy for humans.
That being said, we tried this same experiment with "git stash [show]
<msg>" and ended up rejecting it. However, the main complaint with that
was the failure mode for typos. Typing "git stash sohw" would make a new
stash. In this case, typing "git reflog exipre" would get you:
fatal: ambiguous argument 'exipre': unknown revision or path not in
the working tree.
Use '--' to separate paths from revisions
and you would repeat the command with the typo fixed, which is perhaps
not as bad. And unlike stash, "show" is really the dominant command (I
don't think I have ever manually used 'delete' or 'expire'), so it is
more likely to be right than not.
The current behavior is also weirdly inconsistent:
git reflog ;# works, shows HEAD
git reflog -p ;# works, shows HEAD with -p
git reflog -p foo ;# works, shows foo with -p
git reflog foo ;# does not work
I can see allowing the first two, but the fact that the third works and
the fourth doesn't seems odd to me.
So I don't think the patch is a huge mistake (at least not as huge as
the stash one). However, I personally "git log -g [--oneline]" to be
much easier to remember to use and to type.
-Peff
next prev parent reply other threads:[~2010-04-20 11:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-19 9:52 [PATCH 1/2] reflog: make the 'show' subcommand really the default SZEDER Gábor
2010-04-19 9:52 ` [PATCH 2/2] reflog: remove 'show' from 'expire's usage string SZEDER Gábor
2010-04-20 0:46 ` [PATCH 1/2] reflog: make the 'show' subcommand really the default Junio C Hamano
2010-04-20 11:37 ` Jeff King [this message]
2010-04-22 13:57 ` SZEDER Gábor
2010-04-22 14:40 ` Jeff King
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=20100420113736.GA22907@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=szeder@ira.uka.de \
--cc=torvalds@linux-foundation.org \
/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).