aboutsummaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorTheo Niessink <theo@taletn.com>2011-05-27 18:00:39 +0200
committerJunio C Hamano <gitster@pobox.com>2011-05-27 10:59:16 -0700
commitd1c69255a1014ccaeb9841f2114e20f048556391 (patch)
treecf14af796f23230e0f2cbda339e4bc7074c1c7d1 /git-compat-util.h
parent88135203af9df27c0f9c76c27bbbf48833bb31c8 (diff)
downloadgit-d1c69255a1014ccaeb9841f2114e20f048556391.tar.gz
git-d1c69255a1014ccaeb9841f2114e20f048556391.tar.xz
real_path: do not assume '/' is the path seperator
real_path currently assumes it's input had '/' as path seperator. This assumption does not hold true for the code-path from prefix_path (on Windows), where real_path can be called before normalize_path_copy. Fix real_path so it doesn't make this assumption. Create a helper function to reverse-search for the last path-seperator in a string. Signed-off-by: Theo Niessink <theo@taletn.com> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 79b5122b4..15bf3ef81 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -215,6 +215,10 @@ extern char *gitbasename(char *);
#define is_dir_sep(c) ((c) == '/')
#endif
+#ifndef find_last_dir_sep
+#define find_last_dir_sep(path) strrchr(path, '/')
+#endif
+
#if __HP_cc >= 61000
#define NORETURN __attribute__((noreturn))
#define NORETURN_PTR