From: Junio C Hamano Date: Fri, 27 May 2005 00:52:43 GMT Subject: [PATCH] allow pathspec to end with a slash (take #2) Message-ID: <7v7jhl7an8.fsf_-_@assigned-by-dhcp.cox.net> In-Reply-To: <7vis157ate.fsf@assigned-by-dhcp.cox.net> Oops, wrong patch; I am an idiot. ------------ 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 --- cd /opt/packrat/playpen/public/in-place/git/git.junio/ jit-diff 1: diffcore-pathspec.c # - linus: [PATCH] Make ls-* output consistent with diff-* output format. # + (working tree) diff --git a/diffcore-pathspec.c b/diffcore-pathspec.c --- a/diffcore-pathspec.c +++ b/diffcore-pathspec.c @@ -45,8 +45,12 @@ void diffcore_pathspec(const char **path 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++) { Compilation finished at Thu May 26 17:50:40