# [PATCH] reflog documentation: -n is an alias for --dry-run

5 messages from 2009-09-13 to 2009-09-13. Participants: Nelson Elhage, Jeff King, Erik Faye-Lund.
Thread: https://gitlist.dev/t/20924

## Nelson Elhage, 2009-09-13 03:41

Subject: [PATCH] reflog documentation: -n is an alias for --dry-run
Message-ID: <1252813314-14408-1-git-send-email-nelhage@mit.edu>
URL: https://gitlist.dev/e/1252813314-14408-1-git-send-email-nelhage%40mit.edu

```
Signed-off-by: Nelson Elhage <nelhage@mit.edu>
---
 Documentation/git-reflog.txt |    2 +-
 builtin-reflog.c             |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt
index 7f7a544..b434ff7 100644
--- a/Documentation/git-reflog.txt
+++ b/Documentation/git-reflog.txt
@@ -16,7 +16,7 @@ The command takes various subcommands, and different options
 depending on the subcommand:
 
 [verse]
-'git reflog expire' [--dry-run] [--stale-fix] [--verbose]
+'git reflog expire' [-n | --dry-run] [--stale-fix] [--verbose]
 	[--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...
 +
 'git reflog delete' ref@\{specifier\}...
diff --git a/builtin-reflog.c b/builtin-reflog.c
index 95198c5..f37c57b 100644
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -13,9 +13,9 @@
  */
 
 static const char reflog_expire_usage[] =
-"git reflog (show|expire) [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
+"git reflog (show|expire) [--verbose] [-n | --dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
 static const char reflog_delete_usage[] =
-"git reflog delete [--verbose] [--dry-run] [--rewrite] [--updateref] <refs>...";
+"git reflog delete [--verbose] [-n | --dry-run] [--rewrite] [--updateref] <refs>...";
 
 static unsigned long default_reflog_expire;
 static unsigned long default_reflog_expire_unreachable;
-- 
1.6.3.1.499.ge7b8da

```

## Jeff King, 2009-09-13 09:40

Subject: Re: [PATCH] reflog documentation: -n is an alias for --dry-run
Message-ID: <20090913094032.GC14438@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20090913094032.GC14438%40coredump.intra.peff.net
In-Reply-To: <1252813314-14408-1-git-send-email-nelhage@mit.edu>

```
On Sat, Sep 12, 2009 at 11:41:54PM -0400, Nelson Elhage wrote:

>  static const char reflog_expire_usage[] =
> -"git reflog (show|expire) [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
> +"git reflog (show|expire) [--verbose] [-n | --dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";

Really? I think "git reflog show -n" is not about dry-run at all...

-Peff

```

## Nelson Elhage, 2009-09-13 12:53

Subject: Re: [PATCH] reflog documentation: -n is an alias for --dry-run
Message-ID: <20090913125313.GQ4275@mit.edu>
URL: https://gitlist.dev/e/20090913125313.GQ4275%40mit.edu
In-Reply-To: <20090913094032.GC14438@coredump.intra.peff.net>

```
Oh, I see. I was reading builtin-reflog.c, which, in both
cmd_reflog_expire and cmd_reflog_delete, does check for -n as
synonymous to --dry-run:

if (!strcmp(arg, "--dry-run") || !strcmp(arg, "-n"))
    cb.dry_run = 1;

but I missed that 'reflog show' aliases for git-log, and that that
accepts -n.

Patch withdrawn -- I'd send one documenting that -n works for delete
and expire, but it'd probably just complicate the documentation more
than clarify anything.

- Nelson

On Sun, Sep 13, 2009 at 05:40:32AM -0400, Jeff King wrote:
> On Sat, Sep 12, 2009 at 11:41:54PM -0400, Nelson Elhage wrote:
> 
> >  static const char reflog_expire_usage[] =
> > -"git reflog (show|expire) [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
> > +"git reflog (show|expire) [--verbose] [-n | --dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
> 
> Really? I think "git reflog show -n" is not about dry-run at all...
> 
> -Peff

```

## Erik Faye-Lund, 2009-09-13 13:05

Subject: Re: [PATCH] reflog documentation: -n is an alias for --dry-run
Message-ID: <40aa078e0909130605s5b445fdclb22147ce070d0581@mail.gmail.com>
URL: https://gitlist.dev/e/40aa078e0909130605s5b445fdclb22147ce070d0581%40mail.gmail.com
In-Reply-To: <20090913094032.GC14438@coredump.intra.peff.net>

```
On Sun, Sep 13, 2009 at 11:40 AM, Jeff King <peff@peff.net> wrote:
>>  static const char reflog_expire_usage[] =
>> -"git reflog (show|expire) [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
>> +"git reflog (show|expire) [--verbose] [-n | --dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
>
> Really? I think "git reflog show -n" is not about dry-run at all...

Indeed. However, the reflog expire uses -n as an alias for --dry-run,
according to lines 548-549 of my builtin-reflog.c (ddfdf5a):

		if (!strcmp(arg, "--dry-run") || !strcmp(arg, "-n"))
			cb.dry_run = 1;

...and this usage-string is only output from cmd_reflog_expire, so the
correct solution would IMO be to simply remove show from the
usage-string:

-"git reflog (show|expire) [--verbose] [-n | --dry-run] [--stale-fix]
[--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
+"git reflog expire [--verbose] [-n | --dry-run] [--stale-fix]
[--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";

This issue ("reflog expire" incorrectly documenting "reflog show") was
present before this patch, though. At least the option "--stale-fix"
appears not to be valid for "reflog show".

-- 
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656

```

## Jeff King, 2009-09-13 13:26

Subject: Re: [PATCH] reflog documentation: -n is an alias for --dry-run
Message-ID: <20090913132614.GA26275@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20090913132614.GA26275%40coredump.intra.peff.net
In-Reply-To: <20090913125313.GQ4275@mit.edu>

```
On Sun, Sep 13, 2009 at 08:53:13AM -0400, Nelson Elhage wrote:

> Patch withdrawn -- I'd send one documenting that -n works for delete
> and expire, but it'd probably just complicate the documentation more
> than clarify anything.

I think it would be fine to just split the (show|expire) line into two
separate lines:

> > > -"git reflog (show|expire) [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
> > > +"git reflog (show|expire) [--verbose] [-n | --dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";

-Peff

```
