summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-02-16 05:22:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-02-16 16:54:34 (GMT)
commit4bb43de25977063187dedf054122985bc5a2660e (patch)
tree7e8f344d6ae53bdfd281ba32c12143bd7b07ac51 /path.c
parentd06f15d9c0c2b072e5eebf87fa93ee9a899ed642 (diff)
downloadgit-4bb43de25977063187dedf054122985bc5a2660e.zip
git-4bb43de25977063187dedf054122985bc5a2660e.tar.gz
git-4bb43de25977063187dedf054122985bc5a2660e.tar.bz2
Move offset_1st_component() to path.c
The implementation is also lightly modified to use is_dir_sep() instead of hardcoding '/'. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'path.c')
-rw-r--r--path.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/path.c b/path.c
index 79aa104..06fd9e0 100644
--- a/path.c
+++ b/path.c
@@ -649,3 +649,10 @@ int daemon_avoid_alias(const char *p)
}
}
}
+
+int offset_1st_component(const char *path)
+{
+ if (has_dos_drive_prefix(path))
+ return 2 + is_dir_sep(path[2]);
+ return is_dir_sep(path[0]);
+}