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>
This commit is contained in:
David Reiss
2008-05-19 23:48:54 -07:00
committed by Junio C Hamano
parent 377d9c409f
commit ae299be0e5
6 changed files with 109 additions and 1 deletions

View File

@ -514,6 +514,7 @@ static inline int is_absolute_path(const char *path)
return path[0] == '/';
}
const char *make_absolute_path(const char *path);
int normalize_absolute_path(char *buf, const char *path);
/* Read and unpack a sha1 file into memory, write memory to a sha1 file */
extern int sha1_object_info(const unsigned char *, unsigned long *);