remote-curl: use error instead of fprintf(stderr)
[gitweb.git] / sha1_file.c
index 8b0849f931c5a2f9eea47594b50560fe4526969c..77dbb56946771d631ec544dc1958fcff9215c117 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;
 }
@@ -783,7 +787,7 @@ void close_pack_index(struct packed_git *p)
  * contain the same set of objects as an existing one.  In that case
  * the resulting file might be different even if its name would be the
  * same.  It is best to close any reference to the old pack before it is
- * replaced on disk.  Of course no index pointers nor windows for given pack
+ * replaced on disk.  Of course no index pointers or windows for given pack
  * must subsist at this point.  If ever objects from this pack are requested
  * again, the new version of the pack will be reinitialized through
  * reprepare_packed_git().
@@ -1119,7 +1123,7 @@ static void report_helper(const struct string_list *list,
        const char *msg;
        switch (seen_bits) {
        case 0:
-               msg = "no corresponding .idx nor .pack";
+               msg = "no corresponding .idx or .pack";
                break;
        case 1:
                msg = "no corresponding .idx";