Imported Upstream version 2.17.0
[platform/upstream/git.git] / submodule-config.c
index 33c1b38..602ba8c 100644 (file)
@@ -190,31 +190,6 @@ static struct submodule *cache_lookup_name(struct submodule_cache *cache,
        return NULL;
 }
 
-int check_submodule_name(const char *name)
-{
-       /* Disallow empty names */
-       if (!*name)
-               return -1;
-
-       /*
-        * Look for '..' as a path component. Check both '/' and '\\' as
-        * separators rather than is_dir_sep(), because we want the name rules
-        * to be consistent across platforms.
-        */
-       goto in_component; /* always start inside component */
-       while (*name) {
-               char c = *name++;
-               if (c == '/' || c == '\\') {
-in_component:
-                       if (name[0] == '.' && name[1] == '.' &&
-                           (!name[2] || name[2] == '/' || name[2] == '\\'))
-                               return -1;
-               }
-       }
-
-       return 0;
-}
-
 static int name_and_item_from_var(const char *var, struct strbuf *name,
                                  struct strbuf *item)
 {
@@ -226,12 +201,6 @@ static int name_and_item_from_var(const char *var, struct strbuf *name,
                return 0;
 
        strbuf_add(name, subsection, subsection_len);
-       if (check_submodule_name(name->buf) < 0) {
-               warning(_("ignoring suspicious submodule name: %s"), name->buf);
-               strbuf_release(name);
-               return 0;
-       }
-
        strbuf_addstr(item, key);
 
        return 1;
@@ -383,12 +352,6 @@ static void warn_multiple_config(const unsigned char *treeish_name,
                        commit_string, name, option);
 }
 
-static void warn_command_line_option(const char *var, const char *value)
-{
-       warning(_("ignoring '%s' which may be interpreted as"
-                 " a command-line option: %s"), var, value);
-}
-
 struct parse_config_parameter {
        struct submodule_cache *cache;
        const unsigned char *treeish_name;
@@ -396,13 +359,6 @@ struct parse_config_parameter {
        int overwrite;
 };
 
-/*
- * Parse a config item from .gitmodules.
- *
- * This does not handle submodule-related configuration from the main
- * config store (.git/config, etc).  Callers are responsible for
- * checking for overrides in the main config store when appropriate.
- */
 static int parse_config(const char *var, const char *value, void *data)
 {
        struct parse_config_parameter *me = data;
@@ -421,8 +377,6 @@ static int parse_config(const char *var, const char *value, void *data)
        if (!strcmp(item.buf, "path")) {
                if (!value)
                        ret = config_error_nonbool(var);
-               else if (looks_like_command_line_option(value))
-                       warn_command_line_option(var, value);
                else if (!me->overwrite && submodule->path)
                        warn_multiple_config(me->treeish_name, submodule->name,
                                        "path");
@@ -463,8 +417,6 @@ static int parse_config(const char *var, const char *value, void *data)
        } else if (!strcmp(item.buf, "url")) {
                if (!value) {
                        ret = config_error_nonbool(var);
-               } else if (looks_like_command_line_option(value)) {
-                       warn_command_line_option(var, value);
                } else if (!me->overwrite && submodule->url) {
                        warn_multiple_config(me->treeish_name, submodule->name,
                                        "url");
@@ -480,9 +432,8 @@ static int parse_config(const char *var, const char *value, void *data)
                        warn_multiple_config(me->treeish_name, submodule->name,
                                             "update");
                else if (parse_submodule_update_strategy(value,
-                        &submodule->update_strategy) < 0 ||
-                        submodule->update_strategy.type == SM_UPDATE_COMMAND)
-                       die(_("invalid value for %s"), var);
+                        &submodule->update_strategy) < 0)
+                               die(_("invalid value for %s"), var);
        } else if (!strcmp(item.buf, "shallow")) {
                if (!me->overwrite && submodule->recommend_shallow != -1)
                        warn_multiple_config(me->treeish_name, submodule->name,