Skip to content

Commit

Permalink
Unoptimize info/refs creation.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Sep 15, 2005
1 parent 0f56479 commit 60d0526
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions server-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@

/* refs */
static FILE *info_ref_fp;
static unsigned long info_ref_time;
static int info_ref_is_stale = 0;

static int stat_ref(const char *path, const unsigned char *sha1)
{
struct stat st;
if (!stat(path, &st) && info_ref_time < st.st_mtime)
info_ref_is_stale = 1;
return 0;
}

static int add_info_ref(const char *path, const unsigned char *sha1)
{
Expand All @@ -25,29 +15,13 @@ static int add_info_ref(const char *path, const unsigned char *sha1)

static int update_info_refs(int force)
{
struct stat st;
char *path0 = strdup(git_path("info/refs"));
int len = strlen(path0);
char *path1 = xmalloc(len + 2);

strcpy(path1, path0);
strcpy(path1 + len, "+");

if (!force) {
if (stat(path0, &st)) {
if (errno == ENOENT)
info_ref_is_stale = 1;
else
return error("cannot stat %s", path0);
}
else {
info_ref_time = st.st_mtime;
for_each_ref(stat_ref);
}
if (!info_ref_is_stale)
return 0;
}

safe_create_leading_directories(path0);
info_ref_fp = fopen(path1, "w");
if (!info_ref_fp)
Expand Down

0 comments on commit 60d0526

Please sign in to comment.