aboutsummaryrefslogtreecommitdiffstats
path: root/fsck.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-03-17 14:33:34 -0700
committerJunio C Hamano <gitster@pobox.com>2020-03-17 14:33:34 -0700
commit17a02783d8f7cac1780d8035f3e2e0d25bba077b (patch)
treed90361c2acb4dcea4bc68f0725748fe1c49cd97c /fsck.c
parenta7312d1a28ff3ab0a5a5427b35f01d943103cba8 (diff)
parent69fab82147e74a51ee1144a336eb47c7297b9b78 (diff)
downloadgit-17a02783d8f7cac1780d8035f3e2e0d25bba077b.tar.gz
Git 2.23.2v2.23.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fsck.c')
-rw-r--r--fsck.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/fsck.c b/fsck.c
index ef8b343a72..ea46eeade6 100644
--- a/fsck.c
+++ b/fsck.c
@@ -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",