Wishlist: git commit --no-edit

2012-11-02 Thread Niels Möller
I'd like to have a git commit option which is the opposite of --edit, to
use the selected commit message as is, without invoking any editor.

Main use case I see would be

  git commit --amend --no-edit

(say you fix a typo in the previous commit which doesn't affect the
commit message). Today, one can get the same effect more clumsily as

  EDITOR=touch git commit --amend

Or maybe as

  git commit --amend -C HEAD

But I'd really prefer a --no-edit option over those alternatives. And it
might be useful also in combination with other options, e.g., it would
make the -C option equivalent to -c --no-edit, if I understand it
correctly.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Wishlist: git commit --no-edit

2012-11-02 Thread Matthieu Moy
ni...@lysator.liu.se (Niels Möller) writes:

 I'd like to have a git commit option which is the opposite of --edit, to
 use the selected commit message as is, without invoking any editor.

 Main use case I see would be

   git commit --amend --no-edit

Err, isn't this already working? (maybe your version of Git is too old,
but my 1.7.9.5 does this at least)

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Wishlist: git commit --no-edit

2012-11-02 Thread Jeff King
On Fri, Nov 02, 2012 at 10:42:24AM +0100, Matthieu Moy wrote:

 ni...@lysator.liu.se (Niels Möller) writes:
 
  I'd like to have a git commit option which is the opposite of --edit, to
  use the selected commit message as is, without invoking any editor.
 
  Main use case I see would be
 
git commit --amend --no-edit
 
 Err, isn't this already working? (maybe your version of Git is too old,
 but my 1.7.9.5 does this at least)

Yup, should be working since 1.7.9.

  $ git tag --contains ':/commit: honour --no-edit' |
sort -V |
head -1
  v1.7.9

-Peff
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Wishlist: git commit --no-edit

2012-11-02 Thread Niels Möller
Matthieu Moy matthieu@grenoble-inp.fr writes:

 Err, isn't this already working? (maybe your version of Git is too old,
 but my 1.7.9.5 does this at least)

It may be that I'm confused.

It doesn't work in the version I have (1.7.2.5, debian packaged).

And then I also had a quick look in the source code (of a fresh pull
from https://github.com/git/git.git). In builtin/commit.c, I didn't see
any no-edit flag (but I maybe it's in the OPT_BOOL magic (which is
different from OPT_BOOLEAN?)).

And it's also not mentioned in Documentation/git-commit.txt or on
http://kernel.org/pub/software/scm/git/docs/git-commit.html.

If commit --no-edit does work in recent versions, then all is fine,
except possibly the documentation of it. Thanks.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Wishlist: git commit --no-edit

2012-11-02 Thread Jeff King
[+cc git@vger; please keep discussion on list]

On Fri, Nov 02, 2012 at 10:37:27AM -0200, Thiago Farina wrote:

 git commit --amend --no-edit
 [...]
  Yup, should be working since 1.7.9.
 [...]
 I doesn't appear in the help either:
 
 $ git version
 git version 1.8.0.rc2
 
 $ git commit -h 21 | grep edit
 -c, --reedit-message commit
   reuse and edit message from specified commit
 -e, --editforce edit of commit

Yeah, parse_options doesn't advertise negative forms of boolean options,
as they are implied. I don't think it's a big deal, especially now that
it is covered in more detail in the manpage.

I think changing it would probably involve adding --no-edit as a
separate entry in the options struct.

-Peff
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html