summaryrefslogtreecommitdiff
path: root/diffcore-pathspec.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-27 00:52:43 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-27 01:50:38 (GMT)
commita9c9cef161b26ca610783dd0b180d18956c7b119 (patch)
tree1348af9952a1d26b2ad14ec8f433322fd79510f3 /diffcore-pathspec.c
parentfbe082a528861af785be15bb37d1c7d8f574daa4 (diff)
downloadgit-a9c9cef161b26ca610783dd0b180d18956c7b119.zip
git-a9c9cef161b26ca610783dd0b180d18956c7b119.tar.gz
git-a9c9cef161b26ca610783dd0b180d18956c7b119.tar.bz2
[PATCH] allow pathspec to end with a slash
The recent rewrite broke "git-whatchanged -v -p drivers/usb/" but "git-whatchanged -v -p drivers/usb" still works. Just strip out the trailing slashes internally to make it work again. It uses compare-thing-with-number comparison order instead of visual comparison order ;-). Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'diffcore-pathspec.c')
-rw-r--r--diffcore-pathspec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/diffcore-pathspec.c b/diffcore-pathspec.c
index 78b3cb4..fd11822 100644
--- a/diffcore-pathspec.c
+++ b/diffcore-pathspec.c
@@ -45,8 +45,12 @@ void diffcore_pathspec(const char **pathspec)
speccnt = i;
spec = xmalloc(sizeof(*spec) * speccnt);
for (i = 0; pathspec[i]; i++) {
+ int l;
spec[i].spec = pathspec[i];
- spec[i].len = strlen(pathspec[i]);
+ l = strlen(pathspec[i]);
+ while (l > 0 && pathspec[i][l-1] == '/')
+ l--;
+ spec[i].len = l;
}
for (i = 0; i < q->nr; i++) {