Use hashcpy() when copying object names
[gitweb.git] / sha1_file.c
index 8b0849f931c5a2f9eea47594b50560fe4526969c..019628add50f4957c21f32abb99c06fc6e5f5d2c 100644 (file)
@@ -112,17 +112,21 @@ enum scld_error safe_create_leading_directories(char *path)
 
        while (ret == SCLD_OK && next_component) {
                struct stat st;
-               char *slash = strchr(next_component, '/');
+               char *slash = next_component, slash_character;
 
-               if (!slash)
+               while (*slash && !is_dir_sep(*slash))
+                       slash++;
+
+               if (!*slash)
                        break;
 
                next_component = slash + 1;
-               while (*next_component == '/')
+               while (is_dir_sep(*next_component))
                        next_component++;
                if (!*next_component)
                        break;
 
+               slash_character = *slash;
                *slash = '\0';
                if (!stat(path, &st)) {
                        /* path exists */
@@ -148,7 +152,7 @@ enum scld_error safe_create_leading_directories(char *path)
                } else if (adjust_shared_perm(path)) {
                        ret = SCLD_PERMS;
                }
-               *slash = '/';
+               *slash = slash_character;
        }
        return ret;
 }
@@ -248,8 +252,6 @@ char *sha1_pack_index_name(const unsigned char *sha1)
 struct alternate_object_database *alt_odb_list;
 static struct alternate_object_database **alt_odb_tail;
 
-static int git_open_noatime(const char *name);
-
 /*
  * Prepare alternate object database registry.
  *
@@ -1228,6 +1230,7 @@ static void prepare_packed_git_one(char *objdir, int local)
 
                if (has_extension(de->d_name, ".idx") ||
                    has_extension(de->d_name, ".pack") ||
+                   has_extension(de->d_name, ".bitmap") ||
                    has_extension(de->d_name, ".keep"))
                        string_list_append(&garbage, path);
                else
@@ -1312,7 +1315,6 @@ void prepare_packed_git(void)
 
 void reprepare_packed_git(void)
 {
-       discard_revindex();
        prepare_packed_git_run_once = 0;
        prepare_packed_git();
 }
@@ -1389,7 +1391,7 @@ int check_sha1_signature(const unsigned char *sha1, void *map,
        return hashcmp(sha1, real_sha1) ? -1 : 0;
 }
 
-static int git_open_noatime(const char *name)
+int git_open_noatime(const char *name)
 {
        static int sha1_file_open_flag = O_NOATIME;