summaryrefslogtreecommitdiff
path: root/fsck.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-03-17 13:34:12 -0700
committerJunio C Hamano <gitster@pobox.com>2020-03-17 13:34:12 -0700
commit21a3e5016bb218dc9b016284c88ba685bc446b70 (patch)
tree284b77f6aa29e9ef10881da0400fe7527c017699 /fsck.c
parent9877106b01cbd346b862cc8cd2c52e496dd40ed5 (diff)
parentc42c0f12972194564f039dcf580d89ca14ae72d6 (diff)
downloadgit-21a3e5016bb218dc9b016284c88ba685bc446b70.tar.gz
Git 2.18.3v2.18.3
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 6ccc6388fa..55bd4324e4 100644
--- a/fsck.c
+++ b/fsck.c
@@ -14,6 +14,7 @@
#include "packfile.h"
#include "submodule-config.h"
#include "config.h"
+#include "credential.h"
static struct oidset gitmodules_found = OIDSET_INIT;
static struct oidset gitmodules_done = OIDSET_INIT;
@@ -945,6 +946,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;
@@ -969,7 +983,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",