builtin/reflog: improve grouping of subcommands
The way subcommands of git-reflog(1) are laid out does not make any immediate sense. Reorder them such that read-only subcommands precede writing commands for a bit more structure. Furthermore, move the "expire" subcommand last. This prepares for a subsequent change where we are about to introduce a new "write" command to append reflog entries. Like this, the writing subcommands are ordered such that those affecting a single reflog come before those spanning across all reflogs. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
e9493c55af
commit
649c7bb77a
@@ -11,13 +11,13 @@ SYNOPSIS
|
|||||||
[synopsis]
|
[synopsis]
|
||||||
git reflog [show] [<log-options>] [<ref>]
|
git reflog [show] [<log-options>] [<ref>]
|
||||||
git reflog list
|
git reflog list
|
||||||
git reflog expire [--expire=<time>] [--expire-unreachable=<time>]
|
git reflog exists <ref>
|
||||||
[--rewrite] [--updateref] [--stale-fix]
|
|
||||||
[--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...]
|
|
||||||
git reflog delete [--rewrite] [--updateref]
|
git reflog delete [--rewrite] [--updateref]
|
||||||
[--dry-run | -n] [--verbose] <ref>@{<specifier>}...
|
[--dry-run | -n] [--verbose] <ref>@{<specifier>}...
|
||||||
git reflog drop [--all [--single-worktree] | <refs>...]
|
git reflog drop [--all [--single-worktree] | <refs>...]
|
||||||
git reflog exists <ref>
|
git reflog expire [--expire=<time>] [--expire-unreachable=<time>]
|
||||||
|
[--rewrite] [--updateref] [--stale-fix]
|
||||||
|
[--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...]
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
@@ -43,11 +43,9 @@ actions, and in addition the `HEAD` reflog records branch switching.
|
|||||||
|
|
||||||
The "list" subcommand lists all refs which have a corresponding reflog.
|
The "list" subcommand lists all refs which have a corresponding reflog.
|
||||||
|
|
||||||
The "expire" subcommand prunes older reflog entries. Entries older
|
The "exists" subcommand checks whether a ref has a reflog. It exits
|
||||||
than `expire` time, or entries older than `expire-unreachable` time
|
with zero status if the reflog exists, and non-zero status if it does
|
||||||
and not reachable from the current tip, are removed from the reflog.
|
not.
|
||||||
This is typically not used directly by end users -- instead, see
|
|
||||||
linkgit:git-gc[1].
|
|
||||||
|
|
||||||
The "delete" subcommand deletes single entries from the reflog, but
|
The "delete" subcommand deletes single entries from the reflog, but
|
||||||
not the reflog itself. Its argument must be an _exact_ entry (e.g. "`git
|
not the reflog itself. Its argument must be an _exact_ entry (e.g. "`git
|
||||||
@@ -58,9 +56,11 @@ The "drop" subcommand completely removes the reflog for the specified
|
|||||||
references. This is in contrast to "expire" and "delete", both of which
|
references. This is in contrast to "expire" and "delete", both of which
|
||||||
can be used to delete reflog entries, but not the reflog itself.
|
can be used to delete reflog entries, but not the reflog itself.
|
||||||
|
|
||||||
The "exists" subcommand checks whether a ref has a reflog. It exits
|
The "expire" subcommand prunes older reflog entries. Entries older
|
||||||
with zero status if the reflog exists, and non-zero status if it does
|
than `expire` time, or entries older than `expire-unreachable` time
|
||||||
not.
|
and not reachable from the current tip, are removed from the reflog.
|
||||||
|
This is typically not used directly by end users -- instead, see
|
||||||
|
linkgit:git-gc[1].
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-------
|
-------
|
||||||
@@ -71,6 +71,25 @@ Options for `show`
|
|||||||
`git reflog show` accepts any of the options accepted by `git log`.
|
`git reflog show` accepts any of the options accepted by `git log`.
|
||||||
|
|
||||||
|
|
||||||
|
Options for `delete`
|
||||||
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
`git reflog delete` accepts options `--updateref`, `--rewrite`, `-n`,
|
||||||
|
`--dry-run`, and `--verbose`, with the same meanings as when they are
|
||||||
|
used with `expire`.
|
||||||
|
|
||||||
|
Options for `drop`
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
`--all`::
|
||||||
|
Drop the reflogs of all references from all worktrees.
|
||||||
|
|
||||||
|
`--single-worktree`::
|
||||||
|
By default when `--all` is specified, reflogs from all working
|
||||||
|
trees are dropped. This option limits the processing to reflogs
|
||||||
|
from the current working tree only.
|
||||||
|
|
||||||
|
|
||||||
Options for `expire`
|
Options for `expire`
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -130,24 +149,6 @@ which didn't protect objects referred to by reflogs.
|
|||||||
Print extra information on screen.
|
Print extra information on screen.
|
||||||
|
|
||||||
|
|
||||||
Options for `delete`
|
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
`git reflog delete` accepts options `--updateref`, `--rewrite`, `-n`,
|
|
||||||
`--dry-run`, and `--verbose`, with the same meanings as when they are
|
|
||||||
used with `expire`.
|
|
||||||
|
|
||||||
Options for `drop`
|
|
||||||
~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
`--all`::
|
|
||||||
Drop the reflogs of all references from all worktrees.
|
|
||||||
|
|
||||||
`--single-worktree`::
|
|
||||||
By default when `--all` is specified, reflogs from all working
|
|
||||||
trees are dropped. This option limits the processing to reflogs
|
|
||||||
from the current working tree only.
|
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
---
|
---
|
||||||
Part of the linkgit:git[1] suite
|
Part of the linkgit:git[1] suite
|
||||||
|
|||||||
@@ -17,21 +17,21 @@
|
|||||||
#define BUILTIN_REFLOG_LIST_USAGE \
|
#define BUILTIN_REFLOG_LIST_USAGE \
|
||||||
N_("git reflog list")
|
N_("git reflog list")
|
||||||
|
|
||||||
#define BUILTIN_REFLOG_EXPIRE_USAGE \
|
#define BUILTIN_REFLOG_EXISTS_USAGE \
|
||||||
N_("git reflog expire [--expire=<time>] [--expire-unreachable=<time>]\n" \
|
N_("git reflog exists <ref>")
|
||||||
" [--rewrite] [--updateref] [--stale-fix]\n" \
|
|
||||||
" [--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...]")
|
|
||||||
|
|
||||||
#define BUILTIN_REFLOG_DELETE_USAGE \
|
#define BUILTIN_REFLOG_DELETE_USAGE \
|
||||||
N_("git reflog delete [--rewrite] [--updateref]\n" \
|
N_("git reflog delete [--rewrite] [--updateref]\n" \
|
||||||
" [--dry-run | -n] [--verbose] <ref>@{<specifier>}...")
|
" [--dry-run | -n] [--verbose] <ref>@{<specifier>}...")
|
||||||
|
|
||||||
#define BUILTIN_REFLOG_EXISTS_USAGE \
|
|
||||||
N_("git reflog exists <ref>")
|
|
||||||
|
|
||||||
#define BUILTIN_REFLOG_DROP_USAGE \
|
#define BUILTIN_REFLOG_DROP_USAGE \
|
||||||
N_("git reflog drop [--all [--single-worktree] | <refs>...]")
|
N_("git reflog drop [--all [--single-worktree] | <refs>...]")
|
||||||
|
|
||||||
|
#define BUILTIN_REFLOG_EXPIRE_USAGE \
|
||||||
|
N_("git reflog expire [--expire=<time>] [--expire-unreachable=<time>]\n" \
|
||||||
|
" [--rewrite] [--updateref] [--stale-fix]\n" \
|
||||||
|
" [--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...]")
|
||||||
|
|
||||||
static const char *const reflog_show_usage[] = {
|
static const char *const reflog_show_usage[] = {
|
||||||
BUILTIN_REFLOG_SHOW_USAGE,
|
BUILTIN_REFLOG_SHOW_USAGE,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -42,9 +42,9 @@ static const char *const reflog_list_usage[] = {
|
|||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const reflog_expire_usage[] = {
|
static const char *const reflog_exists_usage[] = {
|
||||||
BUILTIN_REFLOG_EXPIRE_USAGE,
|
BUILTIN_REFLOG_EXISTS_USAGE,
|
||||||
NULL
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const reflog_delete_usage[] = {
|
static const char *const reflog_delete_usage[] = {
|
||||||
@@ -52,23 +52,23 @@ static const char *const reflog_delete_usage[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const reflog_exists_usage[] = {
|
|
||||||
BUILTIN_REFLOG_EXISTS_USAGE,
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *const reflog_drop_usage[] = {
|
static const char *const reflog_drop_usage[] = {
|
||||||
BUILTIN_REFLOG_DROP_USAGE,
|
BUILTIN_REFLOG_DROP_USAGE,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char *const reflog_expire_usage[] = {
|
||||||
|
BUILTIN_REFLOG_EXPIRE_USAGE,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const char *const reflog_usage[] = {
|
static const char *const reflog_usage[] = {
|
||||||
BUILTIN_REFLOG_SHOW_USAGE,
|
BUILTIN_REFLOG_SHOW_USAGE,
|
||||||
BUILTIN_REFLOG_LIST_USAGE,
|
BUILTIN_REFLOG_LIST_USAGE,
|
||||||
BUILTIN_REFLOG_EXPIRE_USAGE,
|
BUILTIN_REFLOG_EXISTS_USAGE,
|
||||||
BUILTIN_REFLOG_DELETE_USAGE,
|
BUILTIN_REFLOG_DELETE_USAGE,
|
||||||
BUILTIN_REFLOG_DROP_USAGE,
|
BUILTIN_REFLOG_DROP_USAGE,
|
||||||
BUILTIN_REFLOG_EXISTS_USAGE,
|
BUILTIN_REFLOG_EXPIRE_USAGE,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -404,10 +404,10 @@ int cmd_reflog(int argc,
|
|||||||
struct option options[] = {
|
struct option options[] = {
|
||||||
OPT_SUBCOMMAND("show", &fn, cmd_reflog_show),
|
OPT_SUBCOMMAND("show", &fn, cmd_reflog_show),
|
||||||
OPT_SUBCOMMAND("list", &fn, cmd_reflog_list),
|
OPT_SUBCOMMAND("list", &fn, cmd_reflog_list),
|
||||||
OPT_SUBCOMMAND("expire", &fn, cmd_reflog_expire),
|
|
||||||
OPT_SUBCOMMAND("delete", &fn, cmd_reflog_delete),
|
|
||||||
OPT_SUBCOMMAND("exists", &fn, cmd_reflog_exists),
|
OPT_SUBCOMMAND("exists", &fn, cmd_reflog_exists),
|
||||||
|
OPT_SUBCOMMAND("delete", &fn, cmd_reflog_delete),
|
||||||
OPT_SUBCOMMAND("drop", &fn, cmd_reflog_drop),
|
OPT_SUBCOMMAND("drop", &fn, cmd_reflog_drop),
|
||||||
|
OPT_SUBCOMMAND("expire", &fn, cmd_reflog_expire),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user