Unoptimize info/refs creation.
The code did not catch the case where you removed an existing ref without changing anything else. We are not talking about hundreds of refs anyway, so remove that optimization. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Sep 14, 2005 at 13:15 UTC
60d0526aaa5d29589420bfadd0623ec878c5edf3
1 file changed
-26
server-info.c
-26
@@ -6,16 +6,6 @@
6
7
/* refs */
8
static FILE *info_ref_fp;
9
-static unsigned long info_ref_time;
10
-static int info_ref_is_stale = 0;
11
-
12
-static int stat_ref(const char *path, const unsigned char *sha1)
13
-{
14
- struct stat st;
15
- if (!stat(path, &st) && info_ref_time < st.st_mtime)
16
- info_ref_is_stale = 1;
17
- return 0;
18
-}
9
10
static int add_info_ref(const char *path, const unsigned char *sha1)
11
{
@@ -25,7 +15,6 @@ static int add_info_ref(const char *path, const unsigned char *sha1)
15
16
static int update_info_refs(int force)
17
{
28
- struct stat st;
18
char *path0 = strdup(git_path("info/refs"));
19
int len = strlen(path0);
20
char *path1 = xmalloc(len + 2);
@@ -33,21 +22,6 @@ static int update_info_refs(int force)
22
strcpy(path1, path0);
23
strcpy(path1 + len, "+");
24
36
- if (!force) {
37
- if (stat(path0, &st)) {
38
- if (errno == ENOENT)
39
- info_ref_is_stale = 1;
40
- else
41
- return error("cannot stat %s", path0);
42
- }
43
- else {
44
- info_ref_time = st.st_mtime;
45
- for_each_ref(stat_ref);
46
- }
47
- if (!info_ref_is_stale)
48
- return 0;
49
- }
50
-
25
safe_create_leading_directories(path0);
26
info_ref_fp = fopen(path1, "w");
27
if (!info_ref_fp)