git/test-path-utils.c
David Reiss ae299be0e5 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>
2008-05-23 14:11:20 -07:00

14 lines
270 B
C

#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;
}