From: Junio C Hamano <junkio@cox.net>
To: Carl Worth <cworth@cworth.org>
Cc: git@vger.kernel.org
Subject: Re: Two ideas for improving git's user interface
Date: Wed, 01 Feb 2006 18:25:46 -0800 [thread overview]
Message-ID: <7vek2mzec5.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <87irrya7bx.wl%cworth@cworth.org> (Carl Worth's message of "Wed, 01 Feb 2006 17:16:18 -0800")
Carl Worth <cworth@cworth.org> writes:
> If not, we should be able to simplify things since a lot of the
> UI complexity being discussed (-a vs. no -a, path names vs. no path
> names), hinges on the handling of skewed files.
I am in agreement with you that "skewed files" might lead to
confusion, but I do not see how that relates to "-a vs no -a" nor
"path names vs no path names" issues.
Let's say we try to detect and forbid committing skewed files. How
would we do that? For the sake of clarity, let's say we fixed the
commit command the way I said in the message you are responding.
Now:
1. "git commit" is the traditional one; it commits the current index.
We enumerate paths that 'git-diff-index --cached --name-only HEAD'
tells are different (they are the paths to be committed -- what
about merges? Maybe take union from all parents?). Then we see if
the paths from "git-diff-files --name-only" (locally modified
files) overlap with them. Overlapping ones will be skewed if we
make a commit.
2. "git commit --also fileA..." updates fileA... on top of the current
index and commits that. After doing "git update-index fileA...",
the story is the same as the previous case.
3. "git commit fileA..." initializes a temporary index from the
current HEAD, updates fileA... and commits that. We would need a
check to make sure index matches HEAD at specified paths, but after
that check passes, there is no skewed files being committed and
there is nothing more to check.
4. "git commit -a" by definition would not have skewed files and there
is nothing to check.
So what you say sounds doable. But I wonder if that really helps
much.
Let's say we want to give an interface to a class of users who do
_not_ want to worry about the presense of the index file. That means
they will _never_ run "git update-index" themselves, although "git
commit", "git add", and "git merge" may run update-index for them
internally. Essentially, you tell them to always use "git commit -a"
or "git commit fileA...", and do not teach them "git commit", "git
commit --also fileA...". IOW they will be doing only 3 or 4. In this
case, we do not need any of the "skewed files" check.
The extra checks in 1 and 2 would prevent index-unaware users from
making obvious mistakes, but if they do not understand index then they
would still be surprised anyway. For example, "git commit" commits
the files they previously run "git add" on, but leaves other modified
files in the working tree uncommitted. This is different from either
3 or 4 that they have learned so far. If they did "git commit fileA",
the file earlier they run "git add" is not committed. If they did
"git commit -a", files other than the added files are also committed.
So in that sense the above checks are doable but I do not think it
helps that much to alleviate the confusion.
These extra checks in 1 and 2 may protect index-aware users from
making mistakes, to a certain degree. I am not convinced enough
myself to pay the cost of extra checks, though, because my workflow is
to do the final review exactly like what you said below.
> My workflow has been to always perform a final review of such a diff
> while composing the commit message. I'd like to be able to do that
> with git.
That matches my workflow. I do either one of these (I never use "git
commit paths..."):
$ work work work
$ I may do update-index [--add|--remove] here
$ git diff --cached
$ git commit
$ work work work
$ I may do update-index [--add|--remove] here
$ git diff HEAD
$ git commit -a
In either cases "skewed files" do not matter. This can be summarized
in a short paragraph:
If you are going to commit with "git commit" (no parameters),
check the final result with "git diff --cached". If you are
going to commit with "git commit -a", check with "git diff
HEAD".
I said why I do not do "git commit paths..." myself, but I think this
"skewed files" discussion adds another thing to be careful about if
you use it. If you do this (with the current tool, you drop --also):
$ work on file A
$ git diff A
... that looks fine so far ...
$ git update-index A
$ work more on file A
$ git diff A
... incrementally that looks fine ...
$ git commit --also A
you would end up commiting something you have not done the "final
review". You need to have the final check before such a commit:
$ work on file A
$ git diff A
... that looks fine so far ...
$ git update-index A
$ work more on file A
$ git diff A
... incrementally that looks fine ...
+++++ $ git diff HEAD
$ git commit --also A
This includes all changes that are not in the index and are not going
to be included in the commit (i.e. changes to files other than A).
For that you may need to do something like:
git-diff-index --cached HEAD ;# already in index but do not look at A
git-diff-index HEAD -- A ;# and path A is taken from working tree
which is a bit cumbersome.
Without --also (the new semantics), the check would be
straightforward:
$ work on file A
$ git diff A
... that looks fine so far ...
$ git update-index A
$ work more on file A
$ git diff A
... incrementally that looks fine ...
+++++ $ git diff HEAD -- A
$ git commit A
next prev parent reply other threads:[~2006-02-02 2:26 UTC|newest]
Thread overview: 105+ 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
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 [this message]
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
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=7vek2mzec5.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=cworth@cworth.org \
--cc=git@vger.kernel.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).