diff options
author | David Reiss <dreiss@facebook.com> | 2008-05-19 23:48:54 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-05-23 14:11:20 -0700 |
commit | ae299be0e5e610027e6492d48d70c1cbb0e9edd8 (patch) | |
tree | 247e12f709c96df4eea12e5759c689a630b02143 /test-path-utils.c | |
parent | 377d9c409ffe0f0d994b929aeb94716139207b9d (diff) | |
download | git-ae299be0e5e610027e6492d48d70c1cbb0e9edd8.tar.gz |
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 <dreiss@facebook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'test-path-utils.c')
-rw-r--r-- | test-path-utils.c | 13 |
1 files changed, 13 insertions, 0 deletions
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; +} |