]> git.ipfire.org Git - thirdparty/git.git/blobdiff - fsck.c
Merge branch 'maint-2.36' into maint-2.37
[thirdparty/git.git] / fsck.c
diff --git a/fsck.c b/fsck.c
index 614c7764294011ae941dc41aa3ae16d56af273ab..47eaeedd7076ba60a621e072abb405127b3c33fe 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -309,7 +309,7 @@ static int fsck_walk_tree(struct tree *tree, void *data, struct fsck_options *op
                return -1;
 
        name = fsck_get_object_name(options, &tree->object.oid);
-       if (init_tree_desc_gently(&desc, tree->buffer, tree->size))
+       if (init_tree_desc_gently(&desc, tree->buffer, tree->size, 0))
                return -1;
        while (tree_entry_gently(&desc, &entry)) {
                struct object *obj;
@@ -579,7 +579,7 @@ static int fsck_tree(const struct object_id *tree_oid,
        const char *o_name;
        struct name_stack df_dup_candidates = { NULL };
 
-       if (init_tree_desc_gently(&desc, buffer, size)) {
+       if (init_tree_desc_gently(&desc, buffer, size, TREE_DESC_RAW_MODES)) {
                retval += report(options, tree_oid, OBJ_TREE,
                                 FSCK_MSG_BAD_TREE,
                                 "cannot be parsed as a tree");
@@ -981,27 +981,16 @@ done:
        return ret;
 }
 
-/*
- * Like builtin/submodule--helper.c's starts_with_dot_slash, but without
- * relying on the platform-dependent is_dir_sep helper.
- *
- * This is for use in checking whether a submodule URL is interpreted as
- * relative to the current directory on any platform, since \ is a
- * directory separator on Windows but not on other platforms.
- */
-static int starts_with_dot_slash(const char *str)
+static int starts_with_dot_slash(const char *const path)
 {
-       return str[0] == '.' && (str[1] == '/' || str[1] == '\\');
+       return path_match_flags(path, PATH_MATCH_STARTS_WITH_DOT_SLASH |
+                               PATH_MATCH_XPLATFORM);
 }
 
-/*
- * Like starts_with_dot_slash, this is a variant of submodule--helper's
- * helper of the same name with the twist that it accepts backslash as a
- * directory separator even on non-Windows platforms.
- */
-static int starts_with_dot_dot_slash(const char *str)
+static int starts_with_dot_dot_slash(const char *const path)
 {
-       return str[0] == '.' && starts_with_dot_slash(str + 1);
+       return path_match_flags(path, PATH_MATCH_STARTS_WITH_DOT_DOT_SLASH |
+                               PATH_MATCH_XPLATFORM);
 }
 
 static int submodule_url_is_relative(const char *url)