diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-03 15:17:03 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-03 15:17:03 +0900 |
commit | a001ef91d93daca995b6f446c23e7213f43b588f (patch) | |
tree | af8148885fde1cdccd604275109d96c44db7a73f /fsck.c | |
parent | 4434cb88b1c567f5f6b4967f065b0c4f64933723 (diff) | |
download | git-a001ef91d93daca995b6f446c23e7213f43b588f.tar.gz git-a001ef91d93daca995b6f446c23e7213f43b588f.tar.bz2 git-a001ef91d93daca995b6f446c23e7213f43b588f.zip |
Imported Upstream version 2.23.2upstream/2.23.2
Diffstat (limited to 'fsck.c')
-rw-r--r-- | fsck.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -15,6 +15,7 @@ #include "packfile.h" #include "submodule-config.h" #include "config.h" +#include "credential.h" #include "help.h" static struct oidset gitmodules_found = OIDSET_INIT; @@ -947,6 +948,19 @@ static int fsck_tag(struct tag *tag, const char *data, return fsck_tag_buffer(tag, data, size, options); } +static int check_submodule_url(const char *url) +{ + struct credential c = CREDENTIAL_INIT; + int ret; + + if (looks_like_command_line_option(url)) + return -1; + + ret = credential_from_url_gently(&c, url, 1); + credential_clear(&c); + return ret; +} + struct fsck_gitmodules_data { struct object *obj; struct fsck_options *options; @@ -971,7 +985,7 @@ static int fsck_gitmodules_fn(const char *var, const char *value, void *vdata) "disallowed submodule name: %s", name); if (!strcmp(key, "url") && value && - looks_like_command_line_option(value)) + check_submodule_url(value) < 0) data->ret |= report(data->options, data->obj, FSCK_MSG_GITMODULES_URL, "disallowed submodule url: %s", |