summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3ba7a06)
raw | patch | inline | side by side (parent: 3ba7a06)
author | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 1 Nov 2010 22:54:20 +0000 (15:54 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 3 Nov 2010 16:25:58 +0000 (09:25 -0700) |
This utility function avoids an unnecessary update of the access time
for a loose object file. Just as the atime isn't useful on a loose
object, its not useful on the pack or the corresonding idx file.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
for a loose object file. Just as the atime isn't useful on a loose
object, its not useful on the pack or the corresonding idx file.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c | patch | blob | history |
diff --git a/sha1_file.c b/sha1_file.c
index 25f6965294fcc6bc440eda32187e0cc2b67e69d1..e53778230026e51034e10678be2795e21b2e7f02 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
const unsigned char null_sha1[20];
+static int git_open_noatime(const char *name);
+
int safe_create_leading_directories(char *path)
{
char *pos = path + offset_1st_component(path);
int fd;
sprintf(path, "%s/%s", relative_base, alt_file_name);
- fd = open(path, O_RDONLY);
+ fd = git_open_noatime(path);
if (fd < 0)
return;
if (fstat(fd, &st) || (st.st_size == 0)) {
struct pack_idx_header *hdr;
size_t idx_size;
uint32_t version, nr, i, *index;
- int fd = open(path, O_RDONLY);
+ int fd = git_open_noatime(path);
struct stat st;
if (fd < 0)
if (!p->index_data && open_pack_index(p))
return error("packfile %s index unavailable", p->pack_name);
- p->pack_fd = open(p->pack_name, O_RDONLY);
+ p->pack_fd = git_open_noatime(p->pack_name);
while (p->pack_fd < 0 && errno == EMFILE && unuse_one_window(p, -1))
- p->pack_fd = open(p->pack_name, O_RDONLY);
+ p->pack_fd = git_open_noatime(p->pack_name);
if (p->pack_fd < 0 || fstat(p->pack_fd, &st))
return -1;