summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2022-06-15 23:35:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-06-16 20:22:03 (GMT)
commitc918f5c1ab0c4dec916b747916236ca0d3655be5 (patch)
tree656d6953fddafb3a2e23f7631996ed9e7ade9da4 /remote.c
parent41f1a8e6a417bc3e56a0eef687e28247138276d1 (diff)
downloadgit-c918f5c1ab0c4dec916b747916236ca0d3655be5.zip
git-c918f5c1ab0c4dec916b747916236ca0d3655be5.tar.gz
git-c918f5c1ab0c4dec916b747916236ca0d3655be5.tar.bz2
relative_url(): fix incorrect condition
In 63e95beb085c (submodule: port resolve_relative_url from shell to C, 2016-04-15), we added a loop over `url` where we are looking for `../` or `./` components. The loop condition we used is the pointer `url` itself, which is clearly not what we wanted. Pointed out by Coverity. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/remote.c b/remote.c
index 9b9bbfe..bded6ac 100644
--- a/remote.c
+++ b/remote.c
@@ -2846,7 +2846,7 @@ char *relative_url(const char *remote_url, const char *url,
* When the url starts with '../', remove that and the
* last directory in remoteurl.
*/
- while (url) {
+ while (*url) {
if (starts_with_dot_dot_slash_native(url)) {
url += 3;
colonsep |= chop_last_dir(&remoteurl, is_relative);