Re: [PATCH] Add support for -p/--patch to git-commit
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Dec 26, 2010, 16:30 UTC
- Message-ID
- <vpqr5d4cx9e.fsf@bauges.imag.fr>
- In-Reply-To
- <E1PWsuV-0000FH-90@scarlatti.dunvegan.biz>
Conrad Irwin <conrad.irwin@gmail.com> writes:
> Hello Git, > > Please let me know of any mistakes I've made, this is a first for > me.
At least one mistake:
To: unlisted-recipients:; (no To-header on input)
(I guess you've Bcc-ed the Git list, please don't do that)
Show 5 quoted lines
> While this patch works as advertised, I wonder if it would be nicer to > change the behaviour of git commit --interactive and git commit -p to > act on a temporary copy of the index rather than mutating the existing > index. I've no idea how to go about that yet, but is it something that > should be changed?
I don't think so. After a commit, I usually expect the index to be clean, ready to start preparing the next commit (except if I explicitely asked the opposite), which implies that the index used for commit (-i|-p) is the same as the usual one.
> +5. by using the --interactive or --patch switches with the 'commit' command > + to decide one by one which files or hunks should be part of the commit, > + before finalizing the operation. Currently, this is done by invoking > + 'git add --interactive'.
... or git add --patch.
> - if (!!also + !!only + !!all + !!interactive > 1)
> - die("Only one of --include/--only/--all/--interactive can be used.");
> + if (!!also + !!only + !!all + !!interactive + !!patch_interactive > 1)
> + die("Only one of --include/--only/--all/--interactive/--patch can be used.");If I read correctly, this forbids "git commit --interactive --patch", while "git add --interactive --patch" is allowed, and equivalent to "--patch" alone.
Other than that, the patch looks good.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/