diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-03-16 11:11:42 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-03-16 12:05:38 -0700 |
commit | d40f108d42fd1d4d2064416629eb987dafb2b113 (patch) | |
tree | 955223b1eea94fc481a6da91e4c30b879a2f207c /builtin/merge.c | |
parent | 52cae643c5d49b7fa18a7a4c60c284f9ae2e2c71 (diff) | |
download | git-jc/a-lone-dash-stands-for-previous-branch.tar.gz |
"-" and "@{-1}" on various programsjc/a-lone-dash-stands-for-previous-branch
JFF stands for just for fun.
This is not meant to give out a model answer and is known to be
incomplete, but I was wondering if it would be a better direction to
allow "-" as a stand-in for "@{-1}" everywhere we allow a branch
name, losing workarounds at the surface level we have for checkout,
merge and revert.
The first three paths are to remove the surface workarounds that
become unnecessary. The one in sha1_name.c is the central change.
The change in revision.c is to allow a single "-" to be recognized
as a potential revision name (without this change, what begins with
"-" is either an option or an unknown option).
So you could do things like "git reset - $path" but also things like
"git log -" after switching out of a branch.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge.c')
-rw-r--r-- | builtin/merge.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin/merge.c b/builtin/merge.c index 3b0f8f96d4..03b260f1dc 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -1164,8 +1164,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix) argc = setup_with_upstream(&argv); else die(_("No commit specified and merge.defaultToUpstream not set.")); - } else if (argc == 1 && !strcmp(argv[0], "-")) - argv[0] = "@{-1}"; + } } if (!argc) usage_with_options(builtin_merge_usage, |