All of lore.kernel.org
 help / color / mirror / Atom feed
* git status -u is mildly astonishing
@ 2015-09-17  9:44 Alastair McGowan-Douglas
  2015-09-17 14:27 ` Matthieu Moy
  0 siblings, 1 reply; 16+ messages in thread
From: Alastair McGowan-Douglas @ 2015-09-17  9:44 UTC (permalink / raw)
  To: git

Hi list,

Today I found what I thought was a bug in git status:

https://paste.fedoraproject.org/268333/42480833/

It seemed that the argument to -u was being ignored. It turns out that
'no' was not actually being considered an argument to -u in the first
place.

The documentation supports this:

       -u[<mode>], --untracked-files[=<mode>]
           Show untracked files.

There is no space here, but it is not obvious that it is *important*
that there is no space here.

The usage string implies that -- is used to disambiguate path specs
from option arguments

    git status [<options>...] [--] [<pathspec>...]

Therefore I would argue that -u is behaving differently from other
arguments (especially when considered across all git subcommands) by
only accepting its argument when not separated by a space. This at
least should be explicitly documented, but, preferably, should be
consistent with other arguments and use the -- token as the separator.

-Altreus

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: git status -u is mildly astonishing
  2015-09-17  9:44 git status -u is mildly astonishing Alastair McGowan-Douglas
@ 2015-09-17 14:27 ` Matthieu Moy
  2015-09-17 17:43   ` Jeff King
  0 siblings, 1 reply; 16+ messages in thread
From: Matthieu Moy @ 2015-09-17 14:27 UTC (permalink / raw)
  To: Alastair McGowan-Douglas; +Cc: git

Alastair McGowan-Douglas <altreus@altre.us> writes:

> It seemed that the argument to -u was being ignored. It turns out that
> 'no' was not actually being considered an argument to -u in the first
> place.

-u takes an optional argument. We can't consider the command-line
argument following u as its argument, because that would mean

  git status -u --null

would be read as

  git status -u=--null

> The usage string implies that -- is used to disambiguate path specs
> from option arguments

Yes, but the problem here is not path specs Vs options, but anything Vs
argument of the previous option.

> Therefore I would argue that -u is behaving differently from other
> arguments (especially when considered across all git subcommands)

This is because you have options with non-optional argument in mind, or
options that have no short version.

If I grep the source correctly, the only options accepting a short
version and an optional string argument are "{merge,am,commit,revert}
-S", "grep -O" and "status -u", which behave consistantly.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: git status -u is mildly astonishing
  2015-09-17 14:27 ` Matthieu Moy
@ 2015-09-17 17:43   ` Jeff King
  2015-09-18  6:52     ` Matthieu Moy
  2015-09-18 15:01     ` [PATCH 0/3] Clarify the documentation of options with optional arguments Matthieu Moy
  0 siblings, 2 replies; 16+ messages in thread
From: Jeff King @ 2015-09-17 17:43 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Alastair McGowan-Douglas, git

On Thu, Sep 17, 2015 at 04:27:39PM +0200, Matthieu Moy wrote:

> > Therefore I would argue that -u is behaving differently from other
> > arguments (especially when considered across all git subcommands)
> 
> This is because you have options with non-optional argument in mind, or
> options that have no short version.
> 
> If I grep the source correctly, the only options accepting a short
> version and an optional string argument are "{merge,am,commit,revert}
> -S", "grep -O" and "status -u", which behave consistantly.

Exactly. This is covered in gitcli(7)*, but I wonder if it is worth
calling attention to this behavior specifically in the documentation of
those options.

-Peff

[*] Try "git help cli", the bit starting with 'Here are the rules
    regarding the "flags"...'.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: git status -u is mildly astonishing
  2015-09-17 17:43   ` Jeff King
@ 2015-09-18  6:52     ` Matthieu Moy
  2015-09-18 15:01     ` [PATCH 0/3] Clarify the documentation of options with optional arguments Matthieu Moy
  1 sibling, 0 replies; 16+ messages in thread
From: Matthieu Moy @ 2015-09-18  6:52 UTC (permalink / raw)
  To: Jeff King; +Cc: Alastair McGowan-Douglas, git

Jeff King <peff@peff.net> writes:

> On Thu, Sep 17, 2015 at 04:27:39PM +0200, Matthieu Moy wrote:
>
>> > Therefore I would argue that -u is behaving differently from other
>> > arguments (especially when considered across all git subcommands)
>> 
>> This is because you have options with non-optional argument in mind, or
>> options that have no short version.
>> 
>> If I grep the source correctly, the only options accepting a short
>> version and an optional string argument are "{merge,am,commit,revert}
>> -S", "grep -O" and "status -u", which behave consistantly.
>
> Exactly. This is covered in gitcli(7)*, but I wonder if it is worth
> calling attention to this behavior specifically in the documentation of
> those options.

I think it does make sense to say it explicitly in the doc for each
option. There are not many, and even though I think Git is doing the
right thing, I also have to admit that it's confusing.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 0/3] Clarify the documentation of options with optional arguments
  2015-09-17 17:43   ` Jeff King
  2015-09-18  6:52     ` Matthieu Moy
@ 2015-09-18 15:01     ` Matthieu Moy
  2015-09-18 15:01       ` [PATCH 1/3] Documentation: use 'keyid' consistantly, not 'key-id' Matthieu Moy
                         ` (3 more replies)
  1 sibling, 4 replies; 16+ messages in thread
From: Matthieu Moy @ 2015-09-18 15:01 UTC (permalink / raw)
  To: gitster; +Cc: git, Alastair McGowan-Douglas, Jeff King, Matthieu Moy

The first patch is essentially to make the last one look good. The
second is a real documentation bug. The last one may be controversial
as it re-documents something already documented in gitcli, but I think
it's a good thing.

Matthieu Moy (3):
  Documentation: use 'keyid' consistantly, not 'key-id'
  Documentation/grep: fix documentation of -O
  Documentation: make explicit that optional arguments must be stuck

 Documentation/git-am.txt          | 3 ++-
 Documentation/git-cherry-pick.txt | 7 ++++---
 Documentation/git-commit-tree.txt | 3 ++-
 Documentation/git-commit.txt      | 3 ++-
 Documentation/git-grep.txt        | 8 +++++---
 Documentation/git-merge.txt       | 4 +++-
 Documentation/git-rebase.txt      | 3 ++-
 Documentation/git-revert.txt      | 7 ++++---
 Documentation/git-status.txt      | 5 +++--
 9 files changed, 27 insertions(+), 16 deletions(-)

-- 
2.5.0.402.g8854c44

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/3] Documentation: use 'keyid' consistantly, not 'key-id'
  2015-09-18 15:01     ` [PATCH 0/3] Clarify the documentation of options with optional arguments Matthieu Moy
@ 2015-09-18 15:01       ` Matthieu Moy
  2015-09-18 15:24         ` Matthieu Moy
  2015-09-18 19:23         ` Jeff King
  2015-09-18 15:01       ` [PATCH 2/3] Documentation/grep: fix documentation of -O Matthieu Moy
                         ` (2 subsequent siblings)
  3 siblings, 2 replies; 16+ messages in thread
From: Matthieu Moy @ 2015-09-18 15:01 UTC (permalink / raw)
  To: gitster; +Cc: git, Alastair McGowan-Douglas, Jeff King, Matthieu Moy

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 Documentation/git-cherry-pick.txt | 4 ++--
 Documentation/git-revert.txt      | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index 1147c71..83b3cc2 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -101,8 +101,8 @@ effect to your index in a row.
 --signoff::
 	Add Signed-off-by line at the end of the commit message.
 
--S[<key-id>]::
---gpg-sign[=<key-id>]::
+-S[<keyid>]::
+--gpg-sign[=<keyid>]::
 	GPG-sign commits.
 
 --ff::
diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
index cceb5f2..6388089 100644
--- a/Documentation/git-revert.txt
+++ b/Documentation/git-revert.txt
@@ -80,8 +80,8 @@ more details.
 This is useful when reverting more than one commits'
 effect to your index in a row.
 
--S[<key-id>]::
---gpg-sign[=<key-id>]::
+-S[<keyid>]::
+--gpg-sign[=<keyid>]::
 	GPG-sign commits.
 
 -s::
-- 
2.5.0.402.g8854c44

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/3] Documentation/grep: fix documentation of -O
  2015-09-18 15:01     ` [PATCH 0/3] Clarify the documentation of options with optional arguments Matthieu Moy
  2015-09-18 15:01       ` [PATCH 1/3] Documentation: use 'keyid' consistantly, not 'key-id' Matthieu Moy
@ 2015-09-18 15:01       ` Matthieu Moy
  2015-09-18 15:01       ` [PATCH 3/3] Documentation: make explicit that optional arguments must be stuck Matthieu Moy
  2015-09-19  7:47       ` [PATCH v2 0/3] Clarify the documentation of options with optional arguments Matthieu Moy
  3 siblings, 0 replies; 16+ messages in thread
From: Matthieu Moy @ 2015-09-18 15:01 UTC (permalink / raw)
  To: gitster; +Cc: git, Alastair McGowan-Douglas, Jeff King, Matthieu Moy

Since the argument of -O, --open-file-in-pager is optional, it must be
stuck to the command. Reflect this in the documentation.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 Documentation/git-grep.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 31811f1..1c07c7f 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -160,8 +160,8 @@ OPTIONS
 	For better compatibility with 'git diff', `--name-only` is a
 	synonym for `--files-with-matches`.
 
--O [<pager>]::
---open-files-in-pager [<pager>]::
+-O[<pager>]::
+--open-files-in-pager[=<pager>]::
 	Open the matching files in the pager (not the output of 'grep').
 	If the pager happens to be "less" or "vi", and the user
 	specified only one pattern, the first file is positioned at
-- 
2.5.0.402.g8854c44

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/3] Documentation: make explicit that optional arguments must be stuck
  2015-09-18 15:01     ` [PATCH 0/3] Clarify the documentation of options with optional arguments Matthieu Moy
  2015-09-18 15:01       ` [PATCH 1/3] Documentation: use 'keyid' consistantly, not 'key-id' Matthieu Moy
  2015-09-18 15:01       ` [PATCH 2/3] Documentation/grep: fix documentation of -O Matthieu Moy
@ 2015-09-18 15:01       ` Matthieu Moy
  2015-09-18 19:27         ` Jeff King
  2015-09-19  7:47       ` [PATCH v2 0/3] Clarify the documentation of options with optional arguments Matthieu Moy
  3 siblings, 1 reply; 16+ messages in thread
From: Matthieu Moy @ 2015-09-18 15:01 UTC (permalink / raw)
  To: gitster; +Cc: git, Alastair McGowan-Douglas, Jeff King, Matthieu Moy

The behavior of command-line options with optional arguments is
documented in gitcli(7), but it is easy for users to miss, and hard for
the same user to understand why e.g. "git status -u no" does not work.

Document this explicitly in the documentation of each short option having
an optional argument: they are the most error prone since there is no '='
sign between the option and its argument.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 Documentation/git-am.txt          | 3 ++-
 Documentation/git-cherry-pick.txt | 3 ++-
 Documentation/git-commit-tree.txt | 3 ++-
 Documentation/git-commit.txt      | 3 ++-
 Documentation/git-grep.txt        | 4 +++-
 Documentation/git-merge.txt       | 4 +++-
 Documentation/git-rebase.txt      | 3 ++-
 Documentation/git-revert.txt      | 3 ++-
 Documentation/git-status.txt      | 5 +++--
 9 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index dbea6e7..5f0082e 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -141,7 +141,8 @@ default.   You can use `--no-utf8` to override this.
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
-	GPG-sign commits.
+	GPG-sign commits. The `keyid` argument is optional; if
+	specified, it must be stuck to the option without a space.
 
 --continue::
 -r::
diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index 83b3cc2..383f57d 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -103,7 +103,8 @@ effect to your index in a row.
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
-	GPG-sign commits.
+	GPG-sign commits. The `keyid` argument is optional; if
+	specified, it must be stuck to the option without a space.
 
 --ff::
 	If the current HEAD is the same as the parent of the
diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt
index f5f2a8d..da2f359 100644
--- a/Documentation/git-commit-tree.txt
+++ b/Documentation/git-commit-tree.txt
@@ -56,7 +56,8 @@ OPTIONS
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
-	GPG-sign commit.
+	GPG-sign commits. The `keyid` argument is optional; if
+	specified, it must be stuck to the option without a space.
 
 --no-gpg-sign::
 	Countermand `commit.gpgSign` configuration variable that is
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 904dafa..99fab5f 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -314,7 +314,8 @@ changes to tracked files.
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
-	GPG-sign commit.
+	GPG-sign commits. The `keyid` argument is optional; if
+	specified, it must be stuck to the option without a space.
 
 --no-gpg-sign::
 	Countermand `commit.gpgSign` configuration variable that is
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 1c07c7f..563d011 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -165,7 +165,9 @@ OPTIONS
 	Open the matching files in the pager (not the output of 'grep').
 	If the pager happens to be "less" or "vi", and the user
 	specified only one pattern, the first file is positioned at
-	the first match automatically.
+	the first match automatically. The `pager` argument is
+	optional; if specified, it must be stuck to the option
+	without a space.
 
 -z::
 --null::
diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index a62d672..8543d88 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -67,7 +67,9 @@ include::merge-options.txt[]
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
-	GPG-sign the resulting merge commit.
+	GPG-sign the resulting merge commit. The `keyid` argument is
+	optional; if specified, it must be stuck to the option
+	without a space.
 
 -m <msg>::
 	Set the commit message to be used for the merge commit (in
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index ca03954..1894431 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -294,7 +294,8 @@ which makes little sense.
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
-	GPG-sign commits.
+	GPG-sign commits. The `keyid` argument is optional; if
+	specified, it must be stuck to the option without a space.
 
 -q::
 --quiet::
diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
index 6388089..cdc3588 100644
--- a/Documentation/git-revert.txt
+++ b/Documentation/git-revert.txt
@@ -82,7 +82,8 @@ effect to your index in a row.
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
-	GPG-sign commits.
+	GPG-sign commits. The `keyid` argument is optional; if
+	specified, it must be stuck to the option without a space.
 
 -s::
 --signoff::
diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index 335f312..e1e8f57 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -53,8 +53,9 @@ OPTIONS
 --untracked-files[=<mode>]::
 	Show untracked files.
 +
-The mode parameter is optional (defaults to 'all'), and is used to
-specify the handling of untracked files.
+The mode parameter is used to specify the handling of untracked files.
+It is optional: it defaults to 'all', and if specified, it must be
+stuck to the option (e.g. `-uno`, but not `-u no`).
 +
 The possible options are:
 +
-- 
2.5.0.402.g8854c44

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] Documentation: use 'keyid' consistantly, not 'key-id'
  2015-09-18 15:01       ` [PATCH 1/3] Documentation: use 'keyid' consistantly, not 'key-id' Matthieu Moy
@ 2015-09-18 15:24         ` Matthieu Moy
  2015-09-18 19:23         ` Jeff King
  1 sibling, 0 replies; 16+ messages in thread
From: Matthieu Moy @ 2015-09-18 15:24 UTC (permalink / raw)
  To: gitster; +Cc: git, Alastair McGowan-Douglas, Jeff King

Subject: ... use 'keyid' consistantly

Sorry, should s/consistantly/consistently/. Will resend.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] Documentation: use 'keyid' consistantly, not 'key-id'
  2015-09-18 15:01       ` [PATCH 1/3] Documentation: use 'keyid' consistantly, not 'key-id' Matthieu Moy
  2015-09-18 15:24         ` Matthieu Moy
@ 2015-09-18 19:23         ` Jeff King
  1 sibling, 0 replies; 16+ messages in thread
From: Jeff King @ 2015-09-18 19:23 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: gitster, git, Alastair McGowan-Douglas

On Fri, Sep 18, 2015 at 05:01:48PM +0200, Matthieu Moy wrote:

> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
>  Documentation/git-cherry-pick.txt | 4 ++--
>  Documentation/git-revert.txt      | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)

Hmm, grepping for `key-id` turns up quite a few more hits. Is there any
reason not to change those, too?

-Peff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/3] Documentation: make explicit that optional arguments must be stuck
  2015-09-18 15:01       ` [PATCH 3/3] Documentation: make explicit that optional arguments must be stuck Matthieu Moy
@ 2015-09-18 19:27         ` Jeff King
  0 siblings, 0 replies; 16+ messages in thread
From: Jeff King @ 2015-09-18 19:27 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: gitster, git, Alastair McGowan-Douglas

On Fri, Sep 18, 2015 at 05:01:50PM +0200, Matthieu Moy wrote:

> The behavior of command-line options with optional arguments is
> documented in gitcli(7), but it is easy for users to miss, and hard for
> the same user to understand why e.g. "git status -u no" does not work.
> 
> Document this explicitly in the documentation of each short option having
> an optional argument: they are the most error prone since there is no '='
> sign between the option and its argument.

I like this. Even though it is redundant, it is getting information to
the place where users can see it, and I don't think it is so large as to
obscure the rest of the content.

> diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
> index dbea6e7..5f0082e 100644
> --- a/Documentation/git-am.txt
> +++ b/Documentation/git-am.txt
> @@ -141,7 +141,8 @@ default.   You can use `--no-utf8` to override this.
>  
>  -S[<keyid>]::
>  --gpg-sign[=<keyid>]::
> -	GPG-sign commits.
> +	GPG-sign commits. The `keyid` argument is optional; if
> +	specified, it must be stuck to the option without a space.

I think this wording is probably OK. At first I thought it was saying
the wrong thing for the long form ("stuck without a space" would mean
"--gpg-sign[keyid]"), but I think the syntax just above makes it pretty
clear.

> diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
> index 335f312..e1e8f57 100644
> --- a/Documentation/git-status.txt
> +++ b/Documentation/git-status.txt
> @@ -53,8 +53,9 @@ OPTIONS
>  --untracked-files[=<mode>]::
>  	Show untracked files.
>  +
> -The mode parameter is optional (defaults to 'all'), and is used to
> -specify the handling of untracked files.
> +The mode parameter is used to specify the handling of untracked files.
> +It is optional: it defaults to 'all', and if specified, it must be
> +stuck to the option (e.g. `-uno`, but not `-u no`).

I think this rearrangement makes the meaning much more clear overall.

-Peff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 0/3] Clarify the documentation of options with optional arguments
  2015-09-18 15:01     ` [PATCH 0/3] Clarify the documentation of options with optional arguments Matthieu Moy
                         ` (2 preceding siblings ...)
  2015-09-18 15:01       ` [PATCH 3/3] Documentation: make explicit that optional arguments must be stuck Matthieu Moy
@ 2015-09-19  7:47       ` Matthieu Moy
  2015-09-19  7:47         ` [PATCH v2 1/3] Documentation: use 'keyid' consistently, not 'key-id' Matthieu Moy
                           ` (3 more replies)
  3 siblings, 4 replies; 16+ messages in thread
From: Matthieu Moy @ 2015-09-19  7:47 UTC (permalink / raw)
  To: gitster; +Cc: git, Alastair McGowan-Douglas, Jeff King, Matthieu Moy

Changes since v2:

* Typo in commit message

* key-id -> keyid in more places. Not so important, but we had cases
  where SYNOPSYS was saying key-id and the full doc keyid, let's make
  it more uniform (and more grep-able).

* Document what --sign-commit and --open-in-pager do when the optional
  argument is not specified.

Matthieu Moy (3):
  Documentation: use 'keyid' consistently, not 'key-id'
  Documentation/grep: fix documentation of -O
  Documentation: explain optional arguments better

 Documentation/git-am.txt          |  4 +++-
 Documentation/git-cherry-pick.txt | 10 ++++++----
 Documentation/git-commit-tree.txt |  4 +++-
 Documentation/git-commit.txt      |  6 ++++--
 Documentation/git-grep.txt        |  9 ++++++---
 Documentation/git-merge.txt       |  6 ++++--
 Documentation/git-rebase.txt      |  4 +++-
 Documentation/git-revert.txt      | 10 ++++++----
 Documentation/git-status.txt      |  5 +++--
 Documentation/git-tag.txt         | 18 +++++++++---------
 10 files changed, 47 insertions(+), 29 deletions(-)

-- 
2.5.0.402.g8854c44

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/3] Documentation: use 'keyid' consistently, not 'key-id'
  2015-09-19  7:47       ` [PATCH v2 0/3] Clarify the documentation of options with optional arguments Matthieu Moy
@ 2015-09-19  7:47         ` Matthieu Moy
  2015-09-19  7:47         ` [PATCH v2 2/3] Documentation/grep: fix documentation of -O Matthieu Moy
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Matthieu Moy @ 2015-09-19  7:47 UTC (permalink / raw)
  To: gitster; +Cc: git, Alastair McGowan-Douglas, Jeff King, Matthieu Moy

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 Documentation/git-cherry-pick.txt |  6 +++---
 Documentation/git-commit.txt      |  2 +-
 Documentation/git-merge.txt       |  2 +-
 Documentation/git-revert.txt      |  6 +++---
 Documentation/git-tag.txt         | 18 +++++++++---------
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index 1147c71..66ab297 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff]
-		  [-S[<key-id>]] <commit>...
+		  [-S[<keyid>]] <commit>...
 'git cherry-pick' --continue
 'git cherry-pick' --quit
 'git cherry-pick' --abort
@@ -101,8 +101,8 @@ effect to your index in a row.
 --signoff::
 	Add Signed-off-by line at the end of the commit message.
 
--S[<key-id>]::
---gpg-sign[=<key-id>]::
+-S[<keyid>]::
+--gpg-sign[=<keyid>]::
 	GPG-sign commits.
 
 --ff::
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 904dafa..51c63d6 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -13,7 +13,7 @@ SYNOPSIS
 	   [-F <file> | -m <msg>] [--reset-author] [--allow-empty]
 	   [--allow-empty-message] [--no-verify] [-e] [--author=<author>]
 	   [--date=<date>] [--cleanup=<mode>] [--[no-]status]
-	   [-i | -o] [-S[<key-id>]] [--] [<file>...]
+	   [-i | -o] [-S[<keyid>]] [--] [<file>...]
 
 DESCRIPTION
 -----------
diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index a62d672..98bf7b1 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -10,7 +10,7 @@ SYNOPSIS
 --------
 [verse]
 'git merge' [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]
-	[-s <strategy>] [-X <strategy-option>] [-S[<key-id>]]
+	[-s <strategy>] [-X <strategy-option>] [-S[<keyid>]]
 	[--[no-]rerere-autoupdate] [-m <msg>] [<commit>...]
 'git merge' <msg> HEAD <commit>...
 'git merge' --abort
diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
index cceb5f2..9eb83f0 100644
--- a/Documentation/git-revert.txt
+++ b/Documentation/git-revert.txt
@@ -8,7 +8,7 @@ git-revert - Revert some existing commits
 SYNOPSIS
 --------
 [verse]
-'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<key-id>]] <commit>...
+'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>...
 'git revert' --continue
 'git revert' --quit
 'git revert' --abort
@@ -80,8 +80,8 @@ more details.
 This is useful when reverting more than one commits'
 effect to your index in a row.
 
--S[<key-id>]::
---gpg-sign[=<key-id>]::
+-S[<keyid>]::
+--gpg-sign[=<keyid>]::
 	GPG-sign commits.
 
 -s::
diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt
index 84f6496..08b4dfb 100644
--- a/Documentation/git-tag.txt
+++ b/Documentation/git-tag.txt
@@ -9,7 +9,7 @@ git-tag - Create, list, delete or verify a tag object signed with GPG
 SYNOPSIS
 --------
 [verse]
-'git tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]
+'git tag' [-a | -s | -u <keyid>] [-f] [-m <msg> | -F <file>]
 	<tagname> [<commit> | <object>]
 'git tag' -d <tagname>...
 'git tag' [-n[<num>]] -l [--contains <commit>] [--points-at <object>]
@@ -24,19 +24,19 @@ to delete, list or verify tags.
 
 Unless `-f` is given, the named tag must not yet exist.
 
-If one of `-a`, `-s`, or `-u <key-id>` is passed, the command
+If one of `-a`, `-s`, or `-u <keyid>` is passed, the command
 creates a 'tag' object, and requires a tag message.  Unless
 `-m <msg>` or `-F <file>` is given, an editor is started for the user to type
 in the tag message.
 
-If `-m <msg>` or `-F <file>` is given and `-a`, `-s`, and `-u <key-id>`
+If `-m <msg>` or `-F <file>` is given and `-a`, `-s`, and `-u <keyid>`
 are absent, `-a` is implied.
 
 Otherwise just a tag reference for the SHA-1 object name of the commit object is
 created (i.e. a lightweight tag).
 
 A GnuPG signed tag object will be created when `-s` or `-u
-<key-id>` is used.  When `-u <key-id>` is not used, the
+<keyid>` is used.  When `-u <keyid>` is not used, the
 committer identity for the current user is used to find the
 GnuPG key for signing. 	The configuration variable `gpg.program`
 is used to specify custom GnuPG binary.
@@ -63,8 +63,8 @@ OPTIONS
 --sign::
 	Make a GPG-signed tag, using the default e-mail address's key.
 
--u <key-id>::
---local-user=<key-id>::
+-u <keyid>::
+--local-user=<keyid>::
 	Make a GPG-signed tag, using the given key.
 
 -f::
@@ -125,14 +125,14 @@ This option is only applicable when listing tags without annotation lines.
 	Use the given tag message (instead of prompting).
 	If multiple `-m` options are given, their values are
 	concatenated as separate paragraphs.
-	Implies `-a` if none of `-a`, `-s`, or `-u <key-id>`
+	Implies `-a` if none of `-a`, `-s`, or `-u <keyid>`
 	is given.
 
 -F <file>::
 --file=<file>::
 	Take the tag message from the given file.  Use '-' to
 	read the message from the standard input.
-	Implies `-a` if none of `-a`, `-s`, or `-u <key-id>`
+	Implies `-a` if none of `-a`, `-s`, or `-u <keyid>`
 	is given.
 
 --cleanup=<mode>::
@@ -166,7 +166,7 @@ it in the repository configuration as follows:
 
 -------------------------------------
 [user]
-    signingKey = <gpg-key-id>
+    signingKey = <gpg-keyid>
 -------------------------------------
 
 
-- 
2.5.0.402.g8854c44

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 2/3] Documentation/grep: fix documentation of -O
  2015-09-19  7:47       ` [PATCH v2 0/3] Clarify the documentation of options with optional arguments Matthieu Moy
  2015-09-19  7:47         ` [PATCH v2 1/3] Documentation: use 'keyid' consistently, not 'key-id' Matthieu Moy
@ 2015-09-19  7:47         ` Matthieu Moy
  2015-09-19  7:47         ` [PATCH v2 3/3] Documentation: explain optional arguments better Matthieu Moy
  2015-09-19 10:50         ` [PATCH v2 0/3] Clarify the documentation of options with optional arguments Jeff King
  3 siblings, 0 replies; 16+ messages in thread
From: Matthieu Moy @ 2015-09-19  7:47 UTC (permalink / raw)
  To: gitster; +Cc: git, Alastair McGowan-Douglas, Jeff King, Matthieu Moy

Since the argument of -O, --open-file-in-pager is optional, it must be
stuck to the command. Reflect this in the documentation.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 Documentation/git-grep.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 31811f1..1c07c7f 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -160,8 +160,8 @@ OPTIONS
 	For better compatibility with 'git diff', `--name-only` is a
 	synonym for `--files-with-matches`.
 
--O [<pager>]::
---open-files-in-pager [<pager>]::
+-O[<pager>]::
+--open-files-in-pager[=<pager>]::
 	Open the matching files in the pager (not the output of 'grep').
 	If the pager happens to be "less" or "vi", and the user
 	specified only one pattern, the first file is positioned at
-- 
2.5.0.402.g8854c44

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 3/3] Documentation: explain optional arguments better
  2015-09-19  7:47       ` [PATCH v2 0/3] Clarify the documentation of options with optional arguments Matthieu Moy
  2015-09-19  7:47         ` [PATCH v2 1/3] Documentation: use 'keyid' consistently, not 'key-id' Matthieu Moy
  2015-09-19  7:47         ` [PATCH v2 2/3] Documentation/grep: fix documentation of -O Matthieu Moy
@ 2015-09-19  7:47         ` Matthieu Moy
  2015-09-19 10:50         ` [PATCH v2 0/3] Clarify the documentation of options with optional arguments Jeff King
  3 siblings, 0 replies; 16+ messages in thread
From: Matthieu Moy @ 2015-09-19  7:47 UTC (permalink / raw)
  To: gitster; +Cc: git, Alastair McGowan-Douglas, Jeff King, Matthieu Moy

Improve the documentation of commands taking optional arguments in two
ways:

* Documents the behavior of '-O' (for grep) and '-S' (for commands
  creating commits) when used without the optional argument.

* Document the syntax of these options.

For the second point, the behavior is documented in gitcli(7), but it is
easy for users to miss, and hard for the same user to understand why e.g.
"git status -u no" does not work.

Document this explicitly in the documentation of each short option having
an optional argument: they are the most error prone since there is no '='
sign between the option and its argument.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 Documentation/git-am.txt          | 4 +++-
 Documentation/git-cherry-pick.txt | 4 +++-
 Documentation/git-commit-tree.txt | 4 +++-
 Documentation/git-commit.txt      | 4 +++-
 Documentation/git-grep.txt        | 5 ++++-
 Documentation/git-merge.txt       | 4 +++-
 Documentation/git-rebase.txt      | 4 +++-
 Documentation/git-revert.txt      | 4 +++-
 Documentation/git-status.txt      | 5 +++--
 9 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index dbea6e7..452c1fe 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -141,7 +141,9 @@ default.   You can use `--no-utf8` to override this.
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
-	GPG-sign commits.
+	GPG-sign commits. The `keyid` argument is optional and
+	defaults to the committer identity; if specified, it must be
+	stuck to the option without a space.
 
 --continue::
 -r::
diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index 66ab297..77da29a 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -103,7 +103,9 @@ effect to your index in a row.
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
-	GPG-sign commits.
+	GPG-sign commits. The `keyid` argument is optional and
+	defaults to the committer identity; if specified, it must be
+	stuck to the option without a space.
 
 --ff::
 	If the current HEAD is the same as the parent of the
diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt
index f5f2a8d..a0b5457 100644
--- a/Documentation/git-commit-tree.txt
+++ b/Documentation/git-commit-tree.txt
@@ -56,7 +56,9 @@ OPTIONS
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
-	GPG-sign commit.
+	GPG-sign commits. The `keyid` argument is optional and
+	defaults to the committer identity; if specified, it must be
+	stuck to the option without a space.
 
 --no-gpg-sign::
 	Countermand `commit.gpgSign` configuration variable that is
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 51c63d6..7f34a5b 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -314,7 +314,9 @@ changes to tracked files.
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
-	GPG-sign commit.
+	GPG-sign commits. The `keyid` argument is optional and
+	defaults to the committer identity; if specified, it must be
+	stuck to the option without a space.
 
 --no-gpg-sign::
 	Countermand `commit.gpgSign` configuration variable that is
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 1c07c7f..4a44d6d 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -165,7 +165,10 @@ OPTIONS
 	Open the matching files in the pager (not the output of 'grep').
 	If the pager happens to be "less" or "vi", and the user
 	specified only one pattern, the first file is positioned at
-	the first match automatically.
+	the first match automatically. The `pager` argument is
+	optional; if specified, it must be stuck to the option
+	without a space. If `pager` is unspecified, the default pager
+	will be used (see `core.pager` in linkgit:git-config[1]).
 
 -z::
 --null::
diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index 98bf7b1..07f7295 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -67,7 +67,9 @@ include::merge-options.txt[]
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
-	GPG-sign the resulting merge commit.
+	GPG-sign the resulting merge commit. The `keyid` argument is
+	optional and defaults to the committer identity; if specified,
+	it must be stuck to the option without a space.
 
 -m <msg>::
 	Set the commit message to be used for the merge commit (in
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index ca03954..bccfdf7 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -294,7 +294,9 @@ which makes little sense.
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
-	GPG-sign commits.
+	GPG-sign commits. The `keyid` argument is optional and
+	defaults to the committer identity; if specified, it must be
+	stuck to the option without a space.
 
 -q::
 --quiet::
diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
index 9eb83f0..b15139f 100644
--- a/Documentation/git-revert.txt
+++ b/Documentation/git-revert.txt
@@ -82,7 +82,9 @@ effect to your index in a row.
 
 -S[<keyid>]::
 --gpg-sign[=<keyid>]::
-	GPG-sign commits.
+	GPG-sign commits. The `keyid` argument is optional and
+	defaults to the committer identity; if specified, it must be
+	stuck to the option without a space.
 
 -s::
 --signoff::
diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index 335f312..e1e8f57 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -53,8 +53,9 @@ OPTIONS
 --untracked-files[=<mode>]::
 	Show untracked files.
 +
-The mode parameter is optional (defaults to 'all'), and is used to
-specify the handling of untracked files.
+The mode parameter is used to specify the handling of untracked files.
+It is optional: it defaults to 'all', and if specified, it must be
+stuck to the option (e.g. `-uno`, but not `-u no`).
 +
 The possible options are:
 +
-- 
2.5.0.402.g8854c44

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/3] Clarify the documentation of options with optional arguments
  2015-09-19  7:47       ` [PATCH v2 0/3] Clarify the documentation of options with optional arguments Matthieu Moy
                           ` (2 preceding siblings ...)
  2015-09-19  7:47         ` [PATCH v2 3/3] Documentation: explain optional arguments better Matthieu Moy
@ 2015-09-19 10:50         ` Jeff King
  3 siblings, 0 replies; 16+ messages in thread
From: Jeff King @ 2015-09-19 10:50 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: gitster, git, Alastair McGowan-Douglas

On Sat, Sep 19, 2015 at 09:47:47AM +0200, Matthieu Moy wrote:

> Changes since v2:
> 
> * Typo in commit message
> 
> * key-id -> keyid in more places. Not so important, but we had cases
>   where SYNOPSYS was saying key-id and the full doc keyid, let's make
>   it more uniform (and more grep-able).
> 
> * Document what --sign-commit and --open-in-pager do when the optional
>   argument is not specified.
> 
> Matthieu Moy (3):
>   Documentation: use 'keyid' consistently, not 'key-id'
>   Documentation/grep: fix documentation of -O
>   Documentation: explain optional arguments better

This all looks good to me.

-Peff

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-09-19 10:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-17  9:44 git status -u is mildly astonishing Alastair McGowan-Douglas
2015-09-17 14:27 ` Matthieu Moy
2015-09-17 17:43   ` Jeff King
2015-09-18  6:52     ` Matthieu Moy
2015-09-18 15:01     ` [PATCH 0/3] Clarify the documentation of options with optional arguments Matthieu Moy
2015-09-18 15:01       ` [PATCH 1/3] Documentation: use 'keyid' consistantly, not 'key-id' Matthieu Moy
2015-09-18 15:24         ` Matthieu Moy
2015-09-18 19:23         ` Jeff King
2015-09-18 15:01       ` [PATCH 2/3] Documentation/grep: fix documentation of -O Matthieu Moy
2015-09-18 15:01       ` [PATCH 3/3] Documentation: make explicit that optional arguments must be stuck Matthieu Moy
2015-09-18 19:27         ` Jeff King
2015-09-19  7:47       ` [PATCH v2 0/3] Clarify the documentation of options with optional arguments Matthieu Moy
2015-09-19  7:47         ` [PATCH v2 1/3] Documentation: use 'keyid' consistently, not 'key-id' Matthieu Moy
2015-09-19  7:47         ` [PATCH v2 2/3] Documentation/grep: fix documentation of -O Matthieu Moy
2015-09-19  7:47         ` [PATCH v2 3/3] Documentation: explain optional arguments better Matthieu Moy
2015-09-19 10:50         ` [PATCH v2 0/3] Clarify the documentation of options with optional arguments Jeff King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.