Discussion:
[PATCH] git-merge: mutually match SYNOPSIS and "usage".
Sergey Organov
2014-10-07 11:54:58 UTC
Permalink
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.

Signed-off-by: Sergey Organov <***@gmail.com>
---
Documentation/git-merge.txt | 6 ++----
builtin/merge.c | 2 +-
2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index cf2c374..e24a1d4 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -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
diff --git a/builtin/merge.c b/builtin/merge.c
index dff043d..086502f 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -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
--
1.9.3
Junio C Hamano
2014-10-07 18:34:41 UTC
Permalink
Post by 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.
Post by Sergey Organov
Documentation/git-merge.txt | 6 ++----
builtin/merge.c | 2 +-
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index cf2c374..e24a1d4 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -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
diff --git a/builtin/merge.c b/builtin/merge.c
index dff043d..086502f 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -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
Sergey Organov
2014-10-07 20:32:35 UTC
Permalink
Post by Junio C Hamano
Post by 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.
Well, I thought they are related, sorry.
Post by Junio C Hamano
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.
Post by Junio C Hamano
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.
Post by Junio C Hamano
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.
--
Sergey.
Junio C Hamano
2014-10-07 21:31:31 UTC
Permalink
Post by Sergey Organov
...
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.
Post by Sergey Organov
Post by Junio C Hamano
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.
Sergey Organov
2014-10-08 10:12:00 UTC
Permalink
Post by Junio C Hamano
Post by Sergey Organov
...
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.
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"?
Post by Junio C Hamano
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.
Post by Junio C Hamano
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.
--
Sergey.
Loading...