summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorKjetil Barvik <barvik@broadpark.no>2009-02-19 20:08:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-02-20 05:39:48 (GMT)
commitfba2f38a2c2cda458e490c18e0afbb12cbd37969 (patch)
tree1702f1a42b940358bb9f5889bbbf1bf88f589f32 /unpack-trees.c
parent8cd6192e16d8bf590afa1105c840b72106d72941 (diff)
downloadgit-fba2f38a2c2cda458e490c18e0afbb12cbd37969.zip
git-fba2f38a2c2cda458e490c18e0afbb12cbd37969.tar.gz
git-fba2f38a2c2cda458e490c18e0afbb12cbd37969.tar.bz2
make USE_NSEC work as expected
Since the filesystem ext4 is now defined as stable in Linux v2.6.28, and ext4 supports nanonsecond resolution timestamps natively, it is time to make USE_NSEC work as expected. This will make racy git situations less likely to happen. For 'git checkout' this means it will be less likely that we have to open, read the contents of the file into RAM, and check if file is really modified or not. The result sould be a litle less used CPU time, less pagefaults and a litle faster program, at least for 'git checkout'. Since the number of possible racy git situations would increase when disks gets faster, this patch would be more and more helpfull as times go by. For a fast Solid State Disk, this patch should be helpfull. Note that, when file operations starts to take less than 1 nanosecond, one would again start to get more racy git situations. For more info on racy git, see Documentation/technical/racy-git.txt For more info on ext4, see http://kernelnewbies.org/Ext4 Signed-off-by: Kjetil Barvik <barvik@broadpark.no> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 273b5da..11902cd 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -360,8 +360,12 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
memset(&o->result, 0, sizeof(o->result));
o->result.initialized = 1;
- if (o->src_index)
- o->result.timestamp = o->src_index->timestamp;
+ if (o->src_index) {
+ o->result.timestamp.sec = o->src_index->timestamp.sec;
+#ifdef USE_NSEC
+ o->result.timestamp.nsec = o->src_index->timestamp.nsec;
+#endif
+ }
o->merge_size = len;
if (!dfc)