diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2009-02-19 20:10:49 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-02-19 22:45:48 -0800 |
commit | 4fcc86b07db26da17f17af0fd777cab78fcaaf4c (patch) | |
tree | 078378b5ea1dcae57f9a2602c71370cb1a962c74 /cache.h | |
parent | 25487f8e2ae266936df0f807ae79dca41606e404 (diff) | |
download | git-4fcc86b07db26da17f17af0fd777cab78fcaaf4c.tar.gz |
Introduce the function strip_path_suffix()
The function strip_path_suffix() will try to strip a given suffix from
a given path. The suffix must start at a directory boundary (i.e. "core"
is not a path suffix of "libexec/git-core", but "git-core" is).
Arbitrary runs of directory separators ("slashes") are assumed identical.
Example:
strip_path_suffix("C:\\msysgit/\\libexec\\git-core",
"libexec///git-core", &prefix)
will set prefix to "C:\\msysgit" and return 0.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -626,6 +626,7 @@ const char *make_nonrelative_path(const char *path); const char *make_relative_path(const char *abs, const char *base); int normalize_path_copy(char *dst, const char *src); int longest_ancestor_length(const char *path, const char *prefix_list); +char *strip_path_suffix(const char *path, const char *suffix); /* Read and unpack a sha1 file into memory, write memory to a sha1 file */ extern int sha1_object_info(const unsigned char *, unsigned long *); |