git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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/
Previous: Conrad IrwinNext: Conrad Irwin
Message 2 of 3 in “Add support for -p/--patch to git-commit”
  1. Add support for -p/--patch to git-commitConrad Irwin, Dec 26, 2010
  2. Matthieu MoyDec 26, 2010
  3. Conrad IrwinDec 26, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.