Introduce the function strip_path_suffix()
commitb824fc9cefb0317b98f6fc34c1192d409e859ea2
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 18 Feb 2009 14:32:55 +0000 (18 15:32 +0100)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 19 Feb 2009 20:10:30 +0000 (19 21:10 +0100)
treedf3c5727d679d360681e9359b7ee315cd4c7d151
parent3cb35a31b04fb8e5cbfda3affcaa87dfee620355
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:

prefix = strip_path_suffix("C:\\msysgit/\\libexec\\git-core",
"libexec///git-core");

will set prefix to "C:\\msysgit".

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
cache.h
path.c
t/t0060-path-utils.sh
test-path-utils.c