From a9c9cef161b26ca610783dd0b180d18956c7b119 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 26 May 2005 17:52:43 -0700 Subject: [PATCH] [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 Signed-off-by: Linus Torvalds --- diffcore-pathspec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/diffcore-pathspec.c b/diffcore-pathspec.c index 78b3cb4c0..fd11822aa 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++) { -- 2.26.2