summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1fa6ead)
raw | patch | inline | side by side (parent: 1fa6ead)
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | |
Sat, 22 Mar 2008 20:19:49 +0000 (13:19 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 9 Apr 2008 08:22:25 +0000 (01:22 -0700) |
This simplifies the matching case of "I already have this file and it is
up-to-date" and makes it do the right thing in the face of
case-insensitive aliases.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
up-to-date" and makes it do the right thing in the face of
case-insensitive aliases.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
read-cache.c | patch | blob | history |
diff --git a/read-cache.c b/read-cache.c
index 5dc998d21e79a8950896e7bb0db38cb137faacc1..8c57adfa166844ec00904187393d97cc7973dd47 100644 (file)
--- a/read-cache.c
+++ b/read-cache.c
int add_file_to_index(struct index_state *istate, const char *path, int verbose)
{
- int size, namelen, pos;
+ int size, namelen;
struct stat st;
- struct cache_entry *ce;
+ struct cache_entry *ce, *alias;
unsigned ce_option = CE_MATCH_IGNORE_VALID|CE_MATCH_RACY_IS_DIRTY;
if (lstat(path, &st))
@@ -466,13 +466,11 @@ 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 &&
- !ce_stage(istate->cache[pos]) &&
- !ie_match_stat(istate, istate->cache[pos], &st, ce_option)) {
+ alias = index_name_exists(istate, ce->name, ce_namelen(ce), ignore_case);
+ if (alias && !ce_stage(alias) && !ie_match_stat(istate, alias, &st, ce_option)) {
/* Nothing changed, really */
free(ce);
- ce_mark_uptodate(istate->cache[pos]);
+ ce_mark_uptodate(alias);
return 0;
}