It happens from time to time to type -amend (with a single
dash) when --amend is meant. In those case there is no mistake
and git commit all files modified with the log message set
to "end". As -amend is just doing something stupid it is
better to check for this wrong usage and give hint to the
user about the possible mistake.
Signed-off-by: Pascal Obry <redacted>
---
parse-options.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
Typing too fast I've just made this mistake the third time today. It is
of course easy to revert but a check seems appropriate here.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
That is ugly. In a source file which is by no means specific to
git-commit, you cannot possibly mean to check for "amend".
Agreed :( I'll try to come with something better.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
From: Charles Bailey <hidden> Date: 2016-06-15 22:44:08
On Thu, Jan 24, 2008 at 07:52:26PM +0100, Pascal Obry wrote:
Johannes Schindelin a écrit :
quoted
That is ugly. In a source file which is by no means specific to
git-commit, you cannot possibly mean to check for "amend".
Agreed :( I'll try to come with something better.
Pascal.
Would this be better handled by a commit-msg hook. E.g.:
test "$(cat $1)" = "end" && {
echo >&2 Commit message is \"end\", possible mis-type of --amend
echo >&2 Use --no-verify to really commit with this commit message
exit 1
}
Would this be better handled by a commit-msg hook. E.g.:
I do not agree. Why check this late as this option is boggus? And
furthermore I do not want to have to install this commit message hook in
all my Git repositories.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
That is ugly. In a source file which is by no means specific to
git-commit, you cannot possibly mean to check for "amend".
Agreed :( I'll try to come with something better.
Some option parsers avoid this sort of ambiguity by not allowing short
options that take a string to be bundled in the same word with other
short options.
So, for example, git-commit -am<msg> would not be allowed, while
git-commit -a -m<msg> and perhaps git-commit -am <msg> would be allowed.
There could still be problems if there were a --mend option that could
be typoed as -mend.
I don't know enough about compatability to say if this would work for git.
--
see shy jo
<relurk>
From: Jörg Sommer <hidden> Date: 2016-06-15 22:44:08
Hi Pascal,
Pascal Obry [off-list ref] wrote:
Typing too fast I've just made this mistake the third time today. It is
of course easy to revert but a check seems appropriate here.
Why not use an alias?
% git config --get alias.cia
commit --amend
Bye, Jörg.
--
Two types have compatible type if their types are the same.
[ANSI C, 6.2.7]