reflog inspection: introduce shortcut "-g"

A short-hand "-g" for "git log --walk-reflogs" and "git
show-branch --reflog" makes it easier to access the reflog
info.

[jc: added -g to show-branch for symmetry]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Johannes Schindelin
2007-01-24 15:05:16 +01:00
committed by Junio C Hamano
parent e955ae957c
commit 084ae0a7bd
4 changed files with 9 additions and 6 deletions

View File

@ -191,7 +191,7 @@ limiting may be applied.
In addition to the '<commit>' listed on the command In addition to the '<commit>' listed on the command
line, read them from the standard input. line, read them from the standard input.
--walk-reflogs:: -g, --walk-reflogs::
Instead of walking the commit ancestry chain, walk Instead of walking the commit ancestry chain, walk
reflog entries from the most recent one to older ones. reflog entries from the most recent one to older ones.

View File

@ -11,7 +11,7 @@ SYNOPSIS
'git-show-branch' [--all] [--remotes] [--topo-order] [--current] 'git-show-branch' [--all] [--remotes] [--topo-order] [--current]
[--more=<n> | --list | --independent | --merge-base] [--more=<n> | --list | --independent | --merge-base]
[--no-name | --sha1-name] [--topics] [<rev> | <glob>]... [--no-name | --sha1-name] [--topics] [<rev> | <glob>]...
'git-show-branch' --reflog[=<n>[,<base>]] [--list] <ref> 'git-show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] <ref>
DESCRIPTION DESCRIPTION
----------- -----------
@ -100,8 +100,8 @@ OPTIONS
--reflog[=<n>[,<base>]] <ref>:: --reflog[=<n>[,<base>]] <ref>::
Shows <n> most recent ref-log entries for the given Shows <n> most recent ref-log entries for the given
ref. If <base> is given, <n> entries going back from ref. If <base> is given, <n> entries going back from
that entry. <base> can be specified as count or date that entry. <base> can be specified as count or date.
`-g` can be used as a short-hand for this option.
Note that --more, --list, --independent and --merge-base options Note that --more, --list, --independent and --merge-base options
are mutually exclusive. are mutually exclusive.

View File

@ -649,11 +649,13 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
dense = 0; dense = 0;
else if (!strcmp(arg, "--date-order")) else if (!strcmp(arg, "--date-order"))
lifo = 0; lifo = 0;
else if (!strcmp(arg, "--reflog")) { else if (!strcmp(arg, "--reflog") || !strcmp(arg, "-g")) {
reflog = DEFAULT_REFLOG; reflog = DEFAULT_REFLOG;
} }
else if (!strncmp(arg, "--reflog=", 9)) else if (!strncmp(arg, "--reflog=", 9))
parse_reflog_param(arg + 9, &reflog, &reflog_base); parse_reflog_param(arg + 9, &reflog, &reflog_base);
else if (!strncmp(arg, "-g=", 3))
parse_reflog_param(arg + 3, &reflog, &reflog_base);
else else
usage(show_branch_usage); usage(show_branch_usage);
ac--; av++; ac--; av++;

View File

@ -868,7 +868,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
handle_reflog(revs, flags); handle_reflog(revs, flags);
continue; continue;
} }
if (!strcmp(arg, "--walk-reflogs")) { if (!strcmp(arg, "-g") ||
!strcmp(arg, "--walk-reflogs")) {
init_reflog_walk(&revs->reflog_info); init_reflog_walk(&revs->reflog_info);
continue; continue;
} }