Skip to contentSkip to conversation

git-merge: inconsistent manual page.

PATCH Sergei Organov 2 participants 5 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

Hello,

git-merge has inconsistent manual page:

1. In the SYNOPSIS, there is [-m <msg>], but OPTIONS section lacks it. The latter has just description of <msg>, suggesting it could be used without -m, but SYNOPSIS doesn't reflect this.

BTW, git-merge options are described in Documentation/merge-options.txt that is also used fot git-pull options, and it's not clear for me if git-pull supports [-m <msg>]. Does it?

2. In the SYNOPSIS, there is no <head> that is described in the OPTIONS.

Overall, it seems that either SYNOPSIS should be changed (see patch below), or historical syntax should be wiped from the manual page.

Documentation/git-merge.txt +1 -1
index bca4212..0ea7aea 100644
@@ -10,7 +10,7 @@ SYNOPSIS
 --------
 [verse]
 'git-merge' [-n] [--summary] [--no-commit] [--squash] [-s <strategy>]...
-	[-m <msg>] <remote> <remote>...
+	[[-m] <msg>] [<head>] <remote> <remote>...
 
 DESCRIPTION
 -----------
Signature · 1 line
Sergei.
#1 lore raw
Quoted 5 lines · Sergei Organov

git-merge has inconsistent manual page:

1. In the SYNOPSIS, there is [-m <msg>], but OPTIONS section lacks it. The latter has just description of <msg>, suggesting it could be used without -m, but SYNOPSIS doesn't reflect this.

This is not quite right, I am afraid. "git merge" used to take its parameters in quite an exotic order, and we still do support it as we do not break people's existing setups:

git-merge "$message" HEAD $list_of_merged_refs

where the second parameter is always HEAD. This is the only form that accepts the message without -m (see ll.230- in the git-merge script).

But we do not _want_ to advertise this funny syntax. Humans and newly written scripts should express the above as:

git merge -m "$message" $list_of_merged_refs

Quoted 4 lines

BTW, git-merge options are described in Documentation/merge-options.txt that is also used fot git-pull options, and it's not clear for me if git-pull supports [-m <msg>]. Does it?

It shouldn't; the merge message is prepared by git-pull to describe what got merged from where for you (see the last few lines in the git-pull script).

Quoted 2 lines

2. In the SYNOPSIS, there is no <head> that is described in the OPTIONS.

See above. We do not want to advertise the crazy syntax.

#2 lore raw

Subject: git-merge: document but discourage the historical syntax

Historically "git merge" took its command line arguments in a rather strange order. Document the historical syntax, and also document clearly that it is not encouraged in new scripts.

There is no reason to deprecate the historical syntax, as the current code can sanely tell which syntax the caller is using, and existing scripts by people do use the historical syntax.

---

Quoted 1 line · Junio C Hamano

See above. We do not want to advertise the crazy syntax.

By the way, I kept saying "crazy" above, but the thing is that when Linus did that "crazy" syntax, it was not crazy at all. Simply it did not matter, as nobody was supposed to use "git merge" from the command line.

Instead, when merging a local branch, you would just have said:

          $ git pull . $my_other_branch

It became a "crazy historical syntax" only after people started talking about using it from the command line, giving it other command line options. And at that point, we introduced -m flag and stopped requiring the second token 'HEAD'.

With that in mind, this might be a better alternative.

 Documentation/git-merge.txt |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Documentation/git-merge.txt +6 -0
index bca4212..a056b40 100644
@@ -11,6 +11,7 @@ SYNOPSIS
 [verse]
 'git-merge' [-n] [--summary] [--no-commit] [--squash] [-s <strategy>]...
 	[-m <msg>] <remote> <remote>...
+'git-merge' <msg> HEAD <remote>...
 
 DESCRIPTION
 -----------
@@ -43,6 +44,11 @@ If you tried a merge which resulted in a complex conflicts and
 would want to start over, you can recover with
 gitlink:git-reset[1].
 
+The second syntax (<msg> `HEAD` <remote>) is supported for
+historical reasons.  Do not use it from the command line or in
+new scripts.
+
+
 CONFIGURATION
 -------------
 
#3 lore raw
Quoted 9 lines · Junio C Hamano

Subject: git-merge: document but discourage the historical syntax

Historically "git merge" took its command line arguments in a rather strange order. Document the historical syntax, and also document clearly that it is not encouraged in new scripts.

There is no reason to deprecate the historical syntax, as the current code can sanely tell which syntax the caller is using, and existing scripts by people do use the historical syntax.

OK, your patch is better than what I've suggested. The only thing that your patch seems to be missing is prepending -m to <msg>:: in the OPTIONS section. Yeah, it could be more strict to just describe <msg>, but if there were no historical syntax, then you'd put '-m <msg>' description in, right? So the latter might be better anyway.

Signature · 1 line
Sergei.
#4 lore raw
Quoted 7 lines · Sergei Organov
Quoted 6 lines · Junio C Hamano

Subject: git-merge: document but discourage the historical syntax

Historically "git merge" took its command line arguments in a rather strange order. Document the historical syntax, and also document clearly that it is not encouraged in new scripts.

Quoted 8 lines
Quoted 3 lines

There is no reason to deprecate the historical syntax, as the current code can sanely tell which syntax the caller is using, and existing scripts by people do use the historical syntax.

OK, your patch is better than what I've suggested. The only thing that your patch seems to be missing is prepending -m to <msg>:: in the OPTIONS section. Yeah, it could be more strict to just describe <msg>,
...

Nah, you are absolutely right. We describe "-s <strategy>" under the headline with the leading "-s".

Will fix.