git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Erik Cervin Edin <erik@cervined.in>
Cc: Christian Couder <christian.couder@gmail.com>,
	jurgen_gjoncari@icloud.com, git <git@vger.kernel.org>
Subject: Re: Make commit messages optional
Date: Mon, 11 Apr 2022 12:24:41 +0200	[thread overview]
Message-ID: <220411.865ynfkj7r.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <CA+JQ7M-uSatD4=HHxaqe4yVAJ5WGuWC_BprX4hnfKSrt6-1GEg@mail.gmail.com>


On Fri, Apr 08 2022, Erik Cervin Edin wrote:

> At the risk of bikeshedding.
>
> The case in favor of not allowing empty commit messages by default is
> that most of the time, empty commit messages are useless.
>
> I've written my fair share of poor commit messages (-,..., wip, foo).
> Sometimes I've fixed that retroactively, sometimes not. The advantage
> I see with empty commit messages is that it's more ubiquitous to
> "write something better" or "whatever". The downside is I can't git
> log --grep '^$' to find them.

You can:

    git log --invert-grep --grep '.'

> On Fri, Apr 8, 2022 at 7:47 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
>> E.g. I wouldn't mind if we made pushes start failing (probably guarded
>> by appropriate isatty() checks) if the user was pushing content without
>> commit messages, unless some option were overridden, or we could start
>> sternly warning about that. Ditto for merging a branch into another one
>> (especially if we can see it's the default branch).
>
> I could see this being a potentially nice option but also pretty much
> .git/hooks/pre-push.sample but with rev-list --grep '^$'  (which
> doesn't appear to work)

The reason it doesn't work is that our --grep doesn't allow for matching
across the whole message, we should fix that, it would be useful in
other contexts.

But for this the --invert-grep above will do what you want. I.e. if our
--grep matches any one character and we discard any that matched with
--invert-grep we're left with empty commit messages.

  reply	other threads:[~2022-04-11 10:29 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08  3:35 Make commit messages optional jurgen_gjoncari
2022-04-08  8:02 ` Christian Couder
2022-04-08 11:26   ` Ævar Arnfjörð Bjarmason
2022-04-08 19:25     ` Erik Cervin Edin
2022-04-11 10:24       ` Ævar Arnfjörð Bjarmason [this message]
2022-04-11 17:59         ` Junio C Hamano
2022-04-11 18:18           ` Michal Suchánek
2022-04-11 21:09             ` Junio C Hamano
2022-04-08  8:15 ` Philip Oakley
2022-04-08 14:32 ` Phillip Susi
2022-04-08 22:30 ` brian m. carlson
2022-04-08 23:32   ` rsbecker
2022-04-09 11:32     ` Michal Suchánek
2022-04-10 13:59       ` Tao Klerks
2022-04-10 15:00         ` rsbecker
2022-04-10 15:18           ` rsbecker
2022-04-10 16:27             ` Tao Klerks
2022-04-13  5:40               ` Jonathan Nieder
2022-04-11  9:04           ` demerphq
2022-04-11 11:35             ` rsbecker
2022-04-11 10:19         ` Ævar Arnfjörð Bjarmason
2022-04-11 12:39           ` Tao Klerks
2022-04-11 18:09             ` Junio C Hamano
2022-04-11 18:15               ` Michal Suchánek
2022-04-11 18:23           ` tytso
2022-04-11 20:10             ` Ævar Arnfjörð Bjarmason
2022-04-14 14:46               ` Theodore Ts'o
2022-04-14 16:43                 ` Ævar Arnfjörð Bjarmason
2022-04-14 17:25                   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=220411.865ynfkj7r.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=erik@cervined.in \
    --cc=git@vger.kernel.org \
    --cc=jurgen_gjoncari@icloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).