git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kristian Høgsberg" <krh@redhat.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] builtin-commit: fix partial-commit support
Date: Mon, 19 Nov 2007 11:47:35 -0500	[thread overview]
Message-ID: <1195490855.16221.2.camel@hinata.boston.redhat.com> (raw)
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:
> 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

      parent reply	other threads:[~2007-11-19 16:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-18 10:21 [PATCH] file_exists(): dangling symlinks do exist Junio C Hamano
2007-11-18 10:21 ` [PATCH] Export three helper functions from ls-files Junio C Hamano
2007-11-18 10:21   ` [PATCH] Fix add_files_to_cache() to take pathspec, not user specified list of files Junio C Hamano
2007-11-18 10:21     ` [PATCH] builtin-commit: fix partial-commit support Junio C Hamano
2007-11-18 10:26       ` Junio C Hamano
2007-11-18 10:57       ` Junio C Hamano
2007-11-18 18:44         ` Junio C Hamano
2007-11-19 16:47       ` Kristian Høgsberg [this message]

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=1195490855.16221.2.camel@hinata.boston.redhat.com \
    --to=krh@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).