]> git.ipfire.org Git - thirdparty/git.git/commitdiff
refs.c: use is_dir_sep() in resolve_gitlink_ref()
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Wed, 23 Aug 2017 12:36:50 +0000 (19:36 +0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 24 Aug 2017 21:42:24 +0000 (14:42 -0700)
The "submodule" argument in this function is a path, which can have
either '/' or '\\' as a separator. Use is_dir_sep() to support both.

Noticed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c

diff --git a/refs.c b/refs.c
index 3d549a89701ab77c973835cd7c556b5a8c6ddd6f..dec899a57a69800a44cebcd05e38c014da43ea3a 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -1507,7 +1507,7 @@ int resolve_gitlink_ref(const char *submodule, const char *refname,
        struct ref_store *refs;
        int flags;
 
-       while (len && submodule[len - 1] == '/')
+       while (len && is_dir_sep(submodule[len - 1]))
                len--;
 
        if (!len)