git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Miles Bader <miles@gnu.org>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"David Aguilar" <davvid@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] Add option to git-commit to allow empty log messages
Date: Mon, 5 Apr 2010 01:51:39 -0400	[thread overview]
Message-ID: <20100405055139.GA28730@coredump.intra.peff.net> (raw)
In-Reply-To: <buor5mu7acd.fsf@dhlpc061.dev.necel.com>

On Mon, Apr 05, 2010 at 02:10:58PM +0900, Miles Bader wrote:

> Junio C Hamano <gitster@pobox.com> writes:
> > As a Porcelain, "git commit" has some leeway to enforce sensible policy on
> > the users, and "forbid commit that does not explain anything" is one such
> > policy.  It is not generally a good idea to expose the full capabilities
> > of plumbing to Porcelain if it leads to bad user behaviour, and such
> > "artificial" limitations are safety features we do not want to remove.
> 
> Isn't the requirement of using a longish option like
> "--allow-empty-message" enough of a warning to users though?
> 
> Although it seems reasonable for git _discourage_ bad practices, I think
> that should generally also be moderated with "... but if you _reallllly_
> want to, you can do this somewhat annoying thing....".  Forcing someone
> to use commit-tree, though, seems a bit much to me; an annoyingly long
> option seems about right.

Yes and no. There are other reasons not to use "git commit" in your
import script. You probably want to pass --allow-empty, too, and
--no-verify.  And you probably want to use --cleanup=none to keep
messages intact.

But most of all, even if you do everything right, we still don't promise
not to change it out from under you in a future version. Because it's
porcelain, and the plumbing method is to use commit-tree.  If
commit-tree is too hard to use, I would rather see the plumbing made
more friendly than encouraging people to build on top of porcelain.

All of that being said, I looked at the snerp-vortex source code (which
started this thread):

  http://github.com/rcaputo/snerp-vortex/blob/master/lib/SVN/Dump/Replayer/Git.pm

It uses several pieces of porcelain. Some in silly ways, like calling
"git status" to avoid calling git-commit when there are no changes and
getting an error code. Which is silly (if you are importing, you
probably want --allow-empty), wasteful (you just need the diff-index
part of status), and now broken (because status is no longer "commit
--dry-run", it always exits with status 0 whether there are changes or
not). Then there are things like calling "git add -f" with arguments,
and a "TODO: split arguments to handle larger filesets" comment. When he
should be using update-index, which takes updates on stdin.

He also notes in the README that it takes 250 seconds to convert his
test repo to git, but only 70 to make a flat filesystem, and that he
wants to move to using fast-import.

So yes, it sucks that his importer does not support empty comments, and
that the OP had to hack around it. But it already doesn't support many
things (like commits with a large number of files, and from what I can
see, files with spaces will break his `find` invocation). The right
answer is for him to move to fast-import, which will be way faster, more
robust, and is actually a supported plumbing interface.

I don't think it's worth adding new features to support a scripting
interface that we are trying to discourage. And I haven't seen another
argument in favor of empty commits besides importing.  Are people
really wanting to make empty commit messages while using git itself?

-Peff

  parent reply	other threads:[~2010-04-05  5:52 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-03 22:06 Does Git really need a commit message to go with a commit? Ævar Arnfjörð Bjarmason
2010-04-04  1:58 ` Avery Pennarun
     [not found] ` <p2kadf1fd3d1004031526r3beff4e3ldd977dfc7e9da782@mail.gmail.com>
     [not found]   ` <h2m51dd1af81004040415xc7381f6cp1bf81bcfd684b99d@mail.gmail.com>
2010-04-04 12:37     ` Santi Béjar
2010-04-04 14:49 ` [PATCH] Add option to git-commit to allow empty log messages Ævar Arnfjörð Bjarmason
2010-04-04 22:43   ` David Aguilar
2010-04-04 23:53     ` Ævar Arnfjörð Bjarmason
2010-04-05  2:11       ` Junio C Hamano
2010-04-05  2:15         ` Sverre Rabbelier
2010-04-05  3:57           ` Junio C Hamano
2010-04-05 14:46             ` Sverre Rabbelier
2010-04-05  5:10         ` Miles Bader
2010-04-05  5:27           ` Junio C Hamano
2010-04-05  5:51           ` Jeff King [this message]
2010-04-05 12:50             ` Ævar Arnfjörð Bjarmason
2010-04-05 17:58               ` Jonathan Nieder
2010-04-05 18:11                 ` Jonathan Nieder
2010-04-06  5:55                 ` Jeff King
2010-04-06  8:40                   ` [PATCH v2] " Ævar Arnfjörð Bjarmason
2010-04-07  5:16                     ` Junio C Hamano
2010-04-07 14:28                       ` Ævar Arnfjörð Bjarmason
2010-04-06  8:42                   ` [PATCH] " Ævar Arnfjörð Bjarmason
2010-04-07 15:09                     ` [PATCH] Remove --allow-empty from the git-commit synopsis Ævar Arnfjörð Bjarmason
2010-04-07 15:29                       ` Sverre Rabbelier
2010-04-07 17:28                         ` [PATCH v2] " Ævar Arnfjörð Bjarmason
2010-04-07 17:52                           ` Sverre Rabbelier
2010-04-07 18:17                             ` Ævar Arnfjörð Bjarmason
2010-04-07 18:21                           ` Tay Ray Chuan
2010-04-07 18:48                             ` [PATCH v3] " Ævar Arnfjörð Bjarmason
2010-04-07 18:55                           ` [PATCH v2] " Johannes Sixt
2010-04-07 19:00                           ` Junio C Hamano
2010-04-07 19:28                             ` [PATCH v4] " Ævar Arnfjörð Bjarmason
2010-04-07 19:45                               ` Stephen Boyd
2010-04-07 22:25                             ` [PATCH v2] " Junio C Hamano
2010-04-08  6:44                               ` Jeff King
2010-04-06  5:43               ` [PATCH] Add option to git-commit to allow empty log messages Jeff King

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=20100405055139.GA28730@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=avarab@gmail.com \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=miles@gnu.org \
    /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).