summaryrefslogtreecommitdiff
path: root/fsck.c
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-03-03 15:17:12 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-03-03 15:17:12 +0900
commit1866b086723a206a29d226a2b5dddcf7c43babfa (patch)
treec6c67bb426288e38a9c0aa4a297a410bed6399ab /fsck.c
parenta9fc46caa4ea41274bd7692ae8b7138a0b6cc121 (diff)
downloadgit-1866b086723a206a29d226a2b5dddcf7c43babfa.tar.gz
git-1866b086723a206a29d226a2b5dddcf7c43babfa.tar.bz2
git-1866b086723a206a29d226a2b5dddcf7c43babfa.zip
Imported Upstream version 2.25.3upstream/2.25.3
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 640d813d..dc6f6ac3 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;
@@ -910,6 +911,19 @@ done:
return ret;
}
+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 {
const struct object_id *oid;
struct fsck_options *options;
@@ -935,7 +949,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->oid, OBJ_BLOB,
FSCK_MSG_GITMODULES_URL,