Skip to contentSkip to conversation

git-merge: mutually match SYNOPSIS and "usage".

PATCH In review Sergey Organov 2 participants 5 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-merge: mutually match SYNOPSIS and "usage".

SYNOPSIS section of the git-merge manual page had outdated explicit list of options.

"usage" returned by 'git merge -h' didn't have "-m <msg>" that is one of essential distinctions between obsolete invocation form and the recent one.

---
 Documentation/git-merge.txt | 6 ++----
 builtin/merge.c             | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)
Documentation/git-merge.txt +2 -4
index cf2c374..e24a1d4 100644
@@ -9,10 +9,8 @@ git-merge - Join two or more development histories together
 SYNOPSIS
 --------
 [verse]
-'git merge' [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]
-	[-s <strategy>] [-X <strategy-option>] [-S[<key-id>]]
-	[--[no-]rerere-autoupdate] [-m <msg>] [<commit>...]
-'git merge' <msg> HEAD <commit>...
+'git merge' [options] [-m <msg>] [<commit>...]
+'git merge' [options] <msg> HEAD <commit>...
 'git merge' --abort
 
 DESCRIPTION
builtin/merge.c +1 -1
index dff043d..086502f 100644
@@ -40,7 +40,7 @@ struct strategy {
 };
 
 static const char * const builtin_merge_usage[] = {
-	N_("git merge [options] [<commit>...]"),
+	N_("git merge [options] [-m <msg>] [<commit>...]"),
 	N_("git merge [options] <msg> HEAD <commit>"),
 	N_("git merge --abort"),
 	NULL
Signature · 1 line
1.9.3
#1 lore raw
Quoted 9 lines · Sergey Organov

SYNOPSIS section of the git-merge manual page had outdated explicit list of options.

"usage" returned by 'git merge -h' didn't have "-m <msg>" that is one of essential distinctions between obsolete invocation form and the recent one.

---

Please do not do two unrelated things in a single change.

It may be a clear and very welcome improvement to change from "explicitly list only often used options" to "just say [options] and have the list of options and their descriptions".

I am not sure about the other change to single out "-m <msg>", especially marking it as optional by enclosing it inside "[-m <msg>]", makes much sense, as that is still not very easily distinguishable from "git merge [options] [<commit>...]". In other words, I agree with your motivation to call for attention that the command behaves differently with and without "-m", but I do not think that part of the change in this patch achieves it well.

Quoted 34 lines
 Documentation/git-merge.txt | 6 ++----
 builtin/merge.c             | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)
Documentation/git-merge.txt +2 -4
index cf2c374..e24a1d4 100644
@@ -9,10 +9,8 @@ git-merge - Join two or more development histories together
 SYNOPSIS
 --------
 [verse]
-'git merge' [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]
-	[-s <strategy>] [-X <strategy-option>] [-S[<key-id>]]
-	[--[no-]rerere-autoupdate] [-m <msg>] [<commit>...]
-'git merge' <msg> HEAD <commit>...
+'git merge' [options] [-m <msg>] [<commit>...]
+'git merge' [options] <msg> HEAD <commit>...
 'git merge' --abort
 
 DESCRIPTION
builtin/merge.c +1 -1
index dff043d..086502f 100644
@@ -40,7 +40,7 @@ struct strategy {
 };
 
 static const char * const builtin_merge_usage[] = {
-	N_("git merge [options] [<commit>...]"),
+	N_("git merge [options] [-m <msg>] [<commit>...]"),
 	N_("git merge [options] <msg> HEAD <commit>"),
 	N_("git merge --abort"),
 	NULL
#2 lore raw
Quoted 5 lines · Junio C Hamano
Quoted 3 lines · Sergey Organov

SYNOPSIS section of the git-merge manual page had outdated explicit list of options.

Quoted 8 lines
Quoted 6 lines

"usage" returned by 'git merge -h' didn't have "-m <msg>" that is one of essential distinctions between obsolete invocation form and the recent one.

---

Please do not do two unrelated things in a single change.

Well, I thought they are related, sorry.

Quoted 3 lines

It may be a clear and very welcome improvement to change from "explicitly list only often used options" to "just say [options] and have the list of options and their descriptions".

OK, noticed.

Quoted 4 lines

I am not sure about the other change to single out "-m <msg>", especially marking it as optional by enclosing it inside "[-m <msg>]", makes much sense, as that is still not very easily distinguishable from "git merge [options] [<commit>...]".

I was looking at the merge.c code, and that's how it seems to work. You can get new semantics without -m, and you can't get old semantics with -m, isn't it? It looks like the set of descriptions I produced is formally correct.

Quoted 3 lines

In other words, I agree with your motivation to call for attention that the command behaves differently with and without "-m", but I do not think that part of the change in this patch achieves it well.

Any particular suggestion?

Thanks.

Signature · 1 line
Sergey.
#3 lore raw
Quoted 6 lines · Sergey Organov

Junio C Hamano <[email protected]> writes:
...
I was looking at the merge.c code, and that's how it seems to work. You can get new semantics without -m, and you can't get old semantics with -m, isn't it? It looks like the set of descriptions I produced is formally correct.

The thing is, with "-m <msg>" we will never fall into the traditional syntax, hence "git merge -m <msg> <msg> HEAD <commit>" appear to be allowed with "git merge [options] <msg> HEAD <commit>...", but it is not.

And the inverse is not true (an obvious example is "git merge $branch", even though it does not have "-m <msg>" it uses the modern & common.

So the updated SYNOPSIS is not really helping.

Quoted 5 lines
Quoted 3 lines

In other words, I agree with your motivation to call for attention that the command behaves differently with and without "-m", but I do not think that part of the change in this patch achieves it well.

Any particular suggestion?

I was going to suggest "explain how the traditional syntax is triggered in the DESCRIPTION section", but it turns out that we already do that.

The second syntax (<msg> HEAD <commit>...) is supported for historical reasons. Do not use it from the command line or in new scripts. It is the same as git merge -m <msg> <commit>....

Strictly speaking, I think it is not qute "the same"---I recall vaguely that it broke tests if you replace the traditional-style invocation in 'git pull' with the -m <msg> syntax, but I do not have details handy; you may want to try it out if you are interested.

So I would think

SYNOPSIS
git merge [options] <commit>... git merge [options] <msg> HEAD <commit>... git merge --abort

should be sufficient, possibly with some clarification on "The second syntax" paragraph in the DESCRIPTION section.

#4 lore raw
Quoted 9 lines · Junio C Hamano
Quoted 6 lines · Sergey Organov

Junio C Hamano <[email protected]> writes:
...
I was looking at the merge.c code, and that's how it seems to work. You can get new semantics without -m, and you can't get old semantics with -m, isn't it? It looks like the set of descriptions I produced is formally correct.

Quoted 4 lines

The thing is, with "-m <msg>" we will never fall into the traditional syntax, hence "git merge -m <msg> <msg> HEAD <commit>" appear to be allowed with "git merge [options] <msg> HEAD <commit>...", but it is not.

No. When you see:

git merge [options] [-m <msg>] <commit>...

Isn't it obvious that 'options' don't include "-m <msg>", so

git merge [options] <msg> HEAD <commit>...

form will never apply when you have "-m <msg>" in the command, exaclty because 'options' don't include "-m <msg"?

Quoted 4 lines

And the inverse is not true (an obvious example is "git merge $branch", even though it does not have "-m <msg>" it uses the modern & common.

Sure, and this is covered as well.

Quoted 1 line

So the updated SYNOPSIS is not really helping.

I disagree, see above.

I still think that for somewhat messy historical situation, the suggested syntax description is good enough.

Signature · 1 line
Sergey.