Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
read-cache.c: split racy stat test to a separate function
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Sun, 8 Mar 2015 10:12:36 +0000
(17:12 +0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 12 Mar 2015 20:45:17 +0000
(13:45 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
read-cache.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
e931371
)
diff --git
a/read-cache.c
b/read-cache.c
index 0d96c753b74d450bf97e1471a58bdd9716a5206a..b5e9c3f8acb58f26ad4f08874585e1684caf2077 100644
(file)
--- a/
read-cache.c
+++ b/
read-cache.c
@@
-272,20
+272,26
@@
static int ce_match_stat_basic(const struct cache_entry *ce, struct stat *st)
return changed;
}
return changed;
}
-static int is_racy_
timestamp
(const struct index_state *istate,
-
const struct cache_entry *ce
)
+static int is_racy_
stat
(const struct index_state *istate,
+
const struct stat_data *sd
)
{
{
- return (!S_ISGITLINK(ce->ce_mode) &&
- istate->timestamp.sec &&
+ return (istate->timestamp.sec &&
#ifdef USE_NSEC
/* nanosecond timestamped files can also be racy! */
#ifdef USE_NSEC
/* nanosecond timestamped files can also be racy! */
- (istate->timestamp.sec <
ce->ce_stat_data.
sd_mtime.sec ||
- (istate->timestamp.sec ==
ce->ce_stat_data.
sd_mtime.sec &&
- istate->timestamp.nsec <=
ce->ce_stat_data.
sd_mtime.nsec))
+ (istate->timestamp.sec <
sd->
sd_mtime.sec ||
+ (istate->timestamp.sec ==
sd->
sd_mtime.sec &&
+ istate->timestamp.nsec <=
sd->
sd_mtime.nsec))
#else
#else
- istate->timestamp.sec <=
ce->ce_stat_data.
sd_mtime.sec
+ istate->timestamp.sec <=
sd->
sd_mtime.sec
#endif
#endif
- );
+ );
+}
+
+static int is_racy_timestamp(const struct index_state *istate,
+ const struct cache_entry *ce)
+{
+ return (!S_ISGITLINK(ce->ce_mode) &&
+ is_racy_stat(istate, &ce->ce_stat_data));
}
int ie_match_stat(const struct index_state *istate,
}
int ie_match_stat(const struct index_state *istate,