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

Re: [PATCH] builtin-commit: fix partial-commit support

From
Kristian Høgsberg <krh@redhat.com>
Date
Nov 19, 2007, 16:47 UTC
Message-ID
<1195490855.16221.2.camel@hinata.boston.redhat.com>
In-Reply-To
<1195381287-26823-4-git-send-email-gitster@pobox.com>
On Sun, 2007-11-18 at 02:21 -0800, Junio C Hamano wrote:
Show 22 quoted lines
> When making a partial-commit, we need to prepare two index
> files, one to be used to write out the tree to be committed
> (temporary index) and the other to be used as the index file
> after the commit is made.
> 
> The temporary index needs to be initialized to HEAD and then all
> the named paths on the command line need to be staged on top of
> the index.  For this, running add_files_to_cache() that compares
> what is in the index and the paths given from the command line
> is not enough -- the comparison will miss the paths that the
> user previously ran "git add" to the index since the HEAD
> because the index reset to the HEAD would not know about them.
> The index file needs to get the same modification done when
> preparing the temporary index as described above.
> 
> This implementation mimics the behaviour of the scripted
> version of git-commit.  It first runs overlay_tree_on_cache(),
> which was stolen from ls-files with the earlier change, to get
> the list of paths that the user can potentially mean, and then
> uses pathspec_match() to find which ones the user meant.  This
> list of paths is used to update both the temporary and the real
> index file.

Oh boy, this turns out to be much more involved than what I thought. Thanks for fixing up this part of builtin-commit.

> Additionally:
> 
>  - remove the temporary index file .git/next-index-* after
>    commit is done or aborted.

Hmm, I see the left-over next-index-* files too, but I though the lock file would be cleaned up automatically by the atexit handler?

cheers, Kristian

Previous: Junio C Hamano
Message 8 of 8 in “file_exists(): dangling symlinks do exist”
  1. file_exists(): dangling symlinks do existJunio C Hamano, Nov 18, 2007
  2. Export three helper functions from ls-filesJunio C Hamano, Nov 18, 2007
  3. Fix add_files_to_cache() to take pathspec, not user specified list of filesJunio C Hamano, Nov 18, 2007
  4. builtin-commit: fix partial-commit supportJunio C Hamano, Nov 18, 2007
  5. Junio C HamanoNov 18, 2007
  6. Junio C HamanoNov 18, 2007
  7. Junio C HamanoNov 18, 2007
  8. Kristian HøgsbergNov 19, 2007

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.