From: Junio C Hamano <gitster@pobox.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Craig Boston <craig@olyun.gank.org>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: Efficient way to import snapshots?
Date: Mon, 30 Jul 2007 14:55:15 -0700 [thread overview]
Message-ID: <7vy7gximkc.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <alpine.LFD.0.999.0707301240330.4161@woody.linux-foundation.org> (Linus Torvalds's message of "Mon, 30 Jul 2007 12:52:52 -0700 (PDT)")
Linus Torvalds <torvalds@linux-foundation.org> writes:
> Junio? I _thought_ we already took the index into account with "git add",
> but we obviously don't.
I think 366bfcb6 "broke" it by moving read_cache() call down,
because it wanted the directory walking code to grab paths that
are already in the index. The change serves its purpose, but
introduces this regression now the responsibility of avoiding
unnecessary reindexing by matching the cached stat is shifted
nowhere.
We would need to do something like this patch, perhaps? This
function has three callers, two in builtin-add and another in
builtin-mv.
---
read-cache.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index a363f31..c346d88 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -380,7 +380,7 @@ static int index_name_pos_also_unmerged(struct index_state *istate,
int add_file_to_index(struct index_state *istate, const char *path, int verbose)
{
- int size, namelen;
+ int size, namelen, pos;
struct stat st;
struct cache_entry *ce;
@@ -414,6 +414,13 @@ int add_file_to_index(struct index_state *istate, const char *path, int verbose)
ce->ce_mode = ce_mode_from_stat(ent, st.st_mode);
}
+ pos = index_name_pos(istate, ce->name, namelen);
+ if (0 <= pos && !ie_modified(istate, istate->cache[pos], &st, 1)) {
+ /* Nothing changed, really */
+ free(ce);
+ return 0;
+ }
+
if (index_path(ce->sha1, path, &st, 1))
die("unable to index file %s", path);
if (add_index_entry(istate, ce, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE))
next prev parent reply other threads:[~2007-07-30 21:55 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-30 18:07 Efficient way to import snapshots? Craig Boston
2007-07-30 18:56 ` Linus Torvalds
2007-07-30 19:29 ` Craig Boston
2007-07-30 19:52 ` Linus Torvalds
2007-07-30 20:10 ` Craig Boston
2007-07-30 21:29 ` Junio C Hamano
2007-07-30 21:49 ` Craig Boston
2007-07-30 21:04 ` Junio C Hamano
2007-07-30 23:19 ` Linus Torvalds
2007-07-30 21:55 ` Junio C Hamano [this message]
2007-07-30 23:27 ` Linus Torvalds
2007-07-30 23:59 ` Junio C Hamano
2007-07-31 0:45 ` Linus Torvalds
2007-07-31 0:47 ` Junio C Hamano
2007-07-30 22:20 ` Craig Boston
2007-07-30 23:30 ` Linus Torvalds
2007-07-31 1:17 ` Craig Boston
2007-07-31 1:44 ` Linus Torvalds
2007-07-31 4:23 ` Theodore Tso
2007-07-31 13:53 ` Craig Boston
2007-07-31 15:50 ` Linus Torvalds
2007-07-31 16:15 ` Theodore Tso
2007-07-31 6:23 ` David Kastrup
2007-07-31 7:54 ` Florian Weimer
2007-07-31 8:48 ` David Kastrup
2007-07-30 21:22 ` Jakub Narebski
2007-07-30 21:54 ` David Kastrup
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=7vy7gximkc.fsf@assigned-by-dhcp.cox.net \
--to=gitster@pobox.com \
--cc=craig@olyun.gank.org \
--cc=git@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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).