From ae299be0e5e610027e6492d48d70c1cbb0e9edd8 Mon Sep 17 00:00:00 2001 From: David Reiss Date: Mon, 19 May 2008 23:48:54 -0700 Subject: Implement normalize_absolute_path normalize_absolute_path removes several oddities form absolute paths, giving nice clean paths like "/dir/sub1/sub2". Also add a test case for this utility, based on a new test program (in the style of test-sha1). Signed-off-by: David Reiss Signed-off-by: Junio C Hamano --- test-path-utils.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test-path-utils.c (limited to 'test-path-utils.c') diff --git a/test-path-utils.c b/test-path-utils.c new file mode 100644 index 0000000000..1bd43216f6 --- /dev/null +++ b/test-path-utils.c @@ -0,0 +1,13 @@ +#include "cache.h" + +int main(int argc, char **argv) +{ + if (argc == 3 && !strcmp(argv[1], "normalize_absolute_path")) { + char *buf = xmalloc(strlen(argv[2])+1); + int rv = normalize_absolute_path(buf, argv[2]); + assert(strlen(buf) == rv); + puts(buf); + } + + return 0; +} -- cgit v1.2.1