From: Junio C Hamano <gitster@pobox.com>
To: "Kristian Høgsberg" <krh@redhat.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 7/7] Implement git commit as a builtin command.
Date: Fri, 21 Sep 2007 12:32:25 -0700 [thread overview]
Message-ID: <7vwsujizli.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1190395088.31494.55.camel@hinata.boston.redhat.com> (Kristian Høgsberg's message of "Fri, 21 Sep 2007 13:18:08 -0400")
Kristian Høgsberg <krh@redhat.com> writes:
>> > +
>> > + /* update the user index file */
>> > + add_files_to_cache(fd, files, prefix);
>> > +
>> > + if (!initial_commit) {
>> > + tree = parse_tree_indirect(head_sha1);
>> > + if (!tree)
>> > + die("failed to unpack HEAD tree object");
>> > + if (read_tree(tree, 0, NULL))
>> > + die("failed to read HEAD tree object");
>> > + }
>>
>> Huh? Doesn't this read_tree() defeat the add_files_to_cache()
>> you did earlier?
>
> This is the case where we add the files on the command line
> to .git/index, but commit from a clean index file corresponding to HEAD
> with the files from the command line added (partial commit?). The first
> add_files_to_cache() updates .git/index, then we do read_tree() to build
> a tmp index from HEAD and then we add the files again. The tmp index is
> written to a tmp index file.
Still, if you are doing read_tree() that reads into the same
in-core cache you have just prepared in the add_fiels_to_cache()
above, potentially overwriting whatever you did, doesn't it?
That was what I was puzzled about...
> ... As for just using an in-memory
> index, I wanted to do it that way originally, but you have to write it
> to disk after all for the pre-commit hook.
Ah, I completely forgot about the hook. Ok, scratch the idea of
not using a temporary index file. The is not much potential for
performance gain anyway.
next prev parent reply other threads:[~2007-09-21 19:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-18 0:06 [PATCH 1/7] Enable wt-status output to a given FILE pointer Kristian Høgsberg
2007-09-18 0:06 ` [PATCH 2/7] Enable wt-status to run against non-standard index file Kristian Høgsberg
2007-09-18 0:06 ` [PATCH 3/7] Introduce entry point for launching add--interactive Kristian Høgsberg
2007-09-18 0:06 ` [PATCH 4/7] Clean up stripspace a bit, use strbuf even more Kristian Høgsberg
2007-09-18 0:06 ` [PATCH 5/7] Add strbuf_read_file() Kristian Høgsberg
2007-09-18 0:06 ` [PATCH 6/7] Export rerere() and launch_editor() Kristian Høgsberg
2007-09-18 0:06 ` [PATCH 7/7] Implement git commit as a builtin command Kristian Høgsberg
2007-09-18 13:58 ` Johannes Schindelin
2007-09-18 15:07 ` Kristian Høgsberg
2007-09-20 1:27 ` Junio C Hamano
2007-09-21 17:18 ` Kristian Høgsberg
2007-09-21 19:32 ` Junio C Hamano [this message]
2007-09-24 20:27 ` Kristian Høgsberg
2007-09-18 13:14 ` [PATCH 6/7] Export rerere() and launch_editor() Johannes Schindelin
2007-09-19 23:52 ` Junio C Hamano
2007-09-21 18:01 ` Kristian Høgsberg
2007-09-18 13:12 ` [PATCH 4/7] Clean up stripspace a bit, use strbuf even more Johannes Schindelin
2007-09-18 13:52 ` Kristian Høgsberg
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=7vwsujizli.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=krh@redhat.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).