diff options
author | Edward Thomson <ethomson@microsoft.com> | 2014-04-08 17:18:47 -0700 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2016-05-26 11:36:11 -0500 |
commit | d34f68261ef95b517944d4fa89ee13b4a68d3cb4 (patch) | |
tree | 686b92a0e7174b891bd4e5a61e480acfc1be5002 /src/path.c | |
parent | 7cb904ba4443c22ff5396769b7d07a7f329c0102 (diff) | |
download | libgit2-d34f68261ef95b517944d4fa89ee13b4a68d3cb4.tar.gz |
Patch parsing from patch files
Diffstat (limited to 'src/path.c')
-rw-r--r-- | src/path.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/path.c b/src/path.c index 4133985a4..e5f04a56a 100644 --- a/src/path.c +++ b/src/path.c @@ -306,6 +306,25 @@ int git_path_join_unrooted( return 0; } +void git_path_squash_slashes(git_buf *path) +{ + char *p, *q; + + if (path->size == 0) + return; + + for (p = path->ptr, q = path->ptr; *q; p++, q++) { + *p = *q; + + while (*q == '/' && *(q+1) == '/') { + path->size--; + q++; + } + } + + *p = '\0'; +} + int git_path_prettify(git_buf *path_out, const char *path, const char *base) { char buf[GIT_PATH_MAX]; |