From: Nicolas Pitre <nico@cam.org>
To: Junio C Hamano <junkio@cox.net>
Cc: Linus Torvalds <torvalds@osdl.org>, git@vger.kernel.org
Subject: Re: [Census] So who uses git?
Date: Wed, 01 Feb 2006 12:18:10 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.64.0602011125370.5397@localhost.localdomain> (raw)
In-Reply-To: <7v4q3jlgw2.fsf@assigned-by-dhcp.cox.net>
On Tue, 31 Jan 2006, Junio C Hamano wrote:
> This "I thought I was only checking in the two-liner I did as
> the last step but you committed the whole thing, stupid git!"
> confusion feels to be a parallel of "I thought I was only
> checking in the files I specified on the command line but you
> also committed the files I earlier git-add'ed, stupid git!"
> confusion.
>
> Taken together with your "during a partially conflicted merge"
> example, it feels to me that the simplest safety valve would be
> to refuse "git commit paths..." if the index does not exactly
> match HEAD. Not just mentioned paths but anywhere.
>
> People who do not like this can set in their config file some
> flag, say, 'core.index = understood', to get the current
> behaviour.
I'd avoid hidden config options that magically change behaviors and
semantics like that as much as possible. _This_ would pave the way to
even greater confusion and prevent the git user base from converging on
a unified semantics knowledge. Better add a command line option which
has the vertue of being visible, and name it such that it make the
intention explicit whether the previous index state is preserved or not,
something like --current-index or the like.
> The reason I am bringing this up is because of this command
> sequence:
>
> # start from a clean tree, after 'git reset --hard'
> $ create a-new-file
> $ git add a-new-file
> $ edit existing-file
> $ edit another-file
> $ git commit existing-file
>
> There is no question we do not commit "another-file" and we do
> commit changes to the "existing-file" as a whole. What should
> we do to "a-new-file", and how do we explain why we do so to
> novices?
>
> We can argue it either way. We could say we shouldn't because
> "commit" argument does not mention it. We could say we should
> because the user already told that he wants to add that file to
> git. Either makes sort-of sense from what the end user did.
It is much more intuitive to expect that, if you specify path arguments
to commit, then only those paths are considered, and even if you didn't
do a git add on some of them. If nothing is specified then the current
index (the default, including a-new-file) is considered.
> I think a file "cvs add"ed is committed if whole subdirectory
> commit (similar to our "commit -a") is done or the file is
> explicitly specified on the "cvs commit" command line, and that
> may match people's expectations. That's an argument for not
> committing "a-new-file".
Exact.
> But to be consistent with that, this should not commit anything:
>
> # the same clean tree.
> $ create a-new-file
> $ git add a-new-file
> $ git commit
>
> Which is counterintuitive to me by now (because I played too
> long with git).
IMHO this should commit a_new_file simply because you added it to the
index and a commit without any argument should commit the whole
(refreshed) index.
> We could make "git commit" without paths to mean the current
> "-a" behaviour, which would match CVS behaviour more closely.
Exact.
> However, it would make commit after a merge conflict resolution
> in a dirty working tree _very_ dangerous -- it may give more
> familiar feel to CVS people, but it is not an improvement for
> git people at all. I would rather not.
For that case, (assuming that -a would be the default) maybe something
meaning the opposite of -a could be specified on the commit argument
list like I suggested earlier. And maybe it should always be the
default when committing a merge (in which case the -a would override
that and refresh everything and not only the merged files plus those
specified on the command line).
So to resume:
- a non-merge commit without any argument would imply -a.
- a non-merge commit with path arguments implies _only_ those paths,
regardless if they were previously "git add"ed or not.
- a non-merge commit with, say, --no-auto or --current-index or
whatever would preserve the current behavior, with or without
additional paths.
- a merge commit would imply that --no-auto behavior automatically.
- a merge commit could override the --no-auto with an explicit -a.
This might look complicated when presented like that, but I think that
the default behavior of each (non-merge vs merge) commit would more
closely fit most people's expectations. The merge commit create a shift
in semantics of course, but committing a merge is already something a
bit more involved anyway and at that point git users should have gained
a bit more experience with the index concept and the default merge
behavior is probably what most people will expect at that point as well.
Nicolas
next prev parent reply other threads:[~2006-02-01 17:18 UTC|newest]
Thread overview: 110+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-26 2:10 LCA06 Cogito/GIT workshop - (Re: git-whatchanged: exit out early on errors) Martin Langhoff
2006-01-28 4:47 ` Linus Torvalds
2006-01-28 5:33 ` Martin Langhoff
2006-01-28 5:53 ` Linus Torvalds
2006-01-28 6:32 ` Junio C Hamano
2006-01-29 10:12 ` Fredrik Kuivinen
2006-01-29 20:15 ` Junio C Hamano
2006-01-28 11:00 ` Keith Packard
2006-01-28 21:08 ` [Census] So who uses git? Junio C Hamano
2006-01-29 2:14 ` Morten Welinder
2006-01-29 3:53 ` Junio C Hamano
2006-01-29 14:19 ` Morten Welinder
2006-01-29 20:15 ` Junio C Hamano
2006-01-29 10:09 ` Keith Packard
2006-01-29 11:18 ` Radoslaw Szkodzinski
2006-01-29 18:12 ` Greg KH
2006-01-31 18:33 ` Radoslaw Szkodzinski
2006-01-31 19:50 ` Radoslaw Szkodzinski
2006-01-31 20:43 ` Junio C Hamano
2006-01-31 21:02 ` Radoslaw Szkodzinski
2006-01-30 22:51 ` Alex Riesen
2006-01-31 21:25 ` Linus Torvalds
2006-01-31 21:52 ` J. Bruce Fields
2006-01-31 22:01 ` Alex Riesen
[not found] ` <20060201013901.GA16832@mail.com>
2006-02-01 2:04 ` Linus Torvalds
2006-02-01 2:09 ` Linus Torvalds
2006-02-09 5:15 ` [PATCH] "Assume unchanged" git Junio C Hamano
2006-02-09 5:49 ` [PATCH] "Assume unchanged" git: do not set CE_VALID with --refresh Junio C Hamano
2006-02-09 5:50 ` [PATCH] ls-files: debugging aid for CE_VALID changes Junio C Hamano
2006-02-01 2:31 ` [Census] So who uses git? Junio C Hamano
2006-02-01 3:43 ` Linus Torvalds
2006-02-01 7:03 ` Junio C Hamano
[not found] ` <20060201045337.GC25753@mail.com>
2006-02-01 5:04 ` Linus Torvalds
2006-02-01 5:42 ` Junio C Hamano
2006-02-01 16:15 ` Jason Riedy
2006-02-01 19:20 ` Julian Phillips
2006-02-01 19:29 ` Linus Torvalds
2006-02-06 21:15 ` Chuck Lever
2006-02-01 2:52 ` Martin Langhoff
2006-02-01 3:48 ` Linus Torvalds
2006-02-01 19:30 ` H. Peter Anvin
2006-02-01 14:55 ` Alex Riesen
2006-02-01 16:25 ` Linus Torvalds
2006-02-02 9:12 ` Alex Riesen
2006-01-29 18:37 ` Dave Jones
2006-01-29 20:17 ` Daniel Barkalow
2006-01-29 20:29 ` Martin Langhoff
2006-01-30 15:23 ` Mike McCormack
2006-01-30 18:58 ` Carl Baldwin
2006-01-31 10:27 ` Johannes Schindelin
2006-01-31 15:24 ` Carl Baldwin
2006-01-31 15:31 ` Johannes Schindelin
2006-01-31 17:30 ` Linus Torvalds
2006-01-31 18:12 ` J. Bruce Fields
2006-01-31 19:33 ` Junio C Hamano
2006-01-31 19:44 ` Jon Loeliger
2006-01-31 19:52 ` Junio C Hamano
[not found] ` <7vd5i8w2nc.fsf@assigned-by-dhcp.cox.net>
2006-01-31 20:56 ` J. Bruce Fields
2006-01-31 20:06 ` J. Bruce Fields
2006-01-31 19:01 ` Keith Packard
2006-01-31 19:21 ` Linus Torvalds
2006-01-31 22:55 ` Joel Becker
2006-02-01 14:43 ` Johannes Schindelin
2006-01-31 20:56 ` Sam Ravnborg
2006-01-31 22:21 ` Junio C Hamano
2006-02-01 19:34 ` H. Peter Anvin
2006-01-31 23:16 ` Daniel Barkalow
2006-01-31 23:36 ` Petr Baudis
2006-01-31 23:47 ` Junio C Hamano
2006-02-01 0:38 ` Linus Torvalds
2006-02-01 0:52 ` Junio C Hamano
2006-02-01 2:19 ` Daniel Barkalow
2006-02-01 6:42 ` Junio C Hamano
2006-02-01 7:22 ` Carl Worth
2006-02-01 8:26 ` Junio C Hamano
2006-02-01 9:59 ` Randal L. Schwartz
2006-02-01 20:48 ` Junio C Hamano
2006-02-01 17:11 ` Linus Torvalds
2006-02-01 17:18 ` Nicolas Pitre [this message]
2006-02-01 20:27 ` Junio C Hamano
2006-02-01 21:09 ` Linus Torvalds
2006-02-01 21:34 ` Nicolas Pitre
2006-02-01 21:59 ` Junio C Hamano
2006-02-01 22:25 ` Nicolas Pitre
2006-02-01 22:50 ` Junio C Hamano
2006-02-02 14:59 ` Andreas Ericsson
2006-02-01 22:35 ` Linus Torvalds
2006-02-01 23:33 ` Two ideas for improving git's user interface Carl Worth
2006-02-02 0:38 ` Junio C Hamano
2006-02-02 1:16 ` Carl Worth
2006-02-02 2:25 ` Junio C Hamano
2006-02-03 23:57 ` Carl Worth
2006-02-02 1:23 ` Linus Torvalds
2006-02-02 1:44 ` Linus Torvalds
2006-02-04 8:03 ` Alan Chandler
2006-02-04 8:25 ` Junio C Hamano
2006-02-04 9:30 ` Alan Chandler
2006-02-04 0:20 ` Carl Worth
2006-02-04 2:08 ` Linus Torvalds
2006-02-06 23:42 ` Carl Worth
2006-02-02 12:31 ` Florian Weimer
2006-02-02 16:30 ` Carl Baldwin
2006-02-01 22:57 ` [Census] So who uses git? Daniel Barkalow
2006-02-01 22:00 ` Joel Becker
2006-02-01 19:32 ` H. Peter Anvin
-- strict thread matches above, loose matches on Subject: below --
2006-02-01 7:08 linux
2006-02-01 8:51 ` Junio C Hamano
2006-02-01 16:04 ` Linus Torvalds
2006-02-01 16:10 ` Alex Riesen
2006-02-01 21:27 ` linux
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0602011125370.5397@localhost.localdomain \
--to=nico@cam.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=torvalds@osdl.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.
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 NNTP newsgroup(s).