git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: git@vger.kernel.org
Subject: [PATCH] Ignore duplicated slashes in git-log
Date: Sat, 9 Feb 2008 13:54:57 +0100	[thread overview]
Message-ID: <20080209125457.GA5686@basil.nowhere.org> (raw)


When I use git-log ... path/name  I seem to regularly
typo path/name as path//name (with duplicated slashes)
The normal kernel ignores these duplicated slashes
according to POSIX so it's typically no problem, but git 
fails and cannot find the correct file name when this
happens.

This patch fixes this case for git-log at least, by
handling duplicated slashes as a single slash. I probably
didn't change all places where file names are parsed
in the source base, but this seems to be a relatively common
place used by several sub commands. And at least for me
fixing git-log is the most important case anyways.

Patch against git 1.5.4

-Andi

diff -u git-1.5.4/setup.c-o git-1.5.4/setup.c
--- git-1.5.4/setup.c-o	2008-02-09 13:35:21.000000000 +0100
+++ git-1.5.4/setup.c	2008-02-09 13:47:53.000000000 +0100
@@ -7,6 +7,11 @@
 const char *prefix_path(const char *prefix, int len, const char *path)
 {
 	const char *orig = path;
+	char *s;
+
+	while ((s = strstr(path, "//")) != NULL)
+		memmove(s, s + 1, strlen(s));
+
 	for (;;) {
 		char c;
 		if (*path != '.')

             reply	other threads:[~2008-02-09 13:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-09 12:54 Andi Kleen [this message]
2008-02-09 13:24 ` [PATCH] Ignore duplicated slashes in git-log Johannes Schindelin
2008-02-09 14:16   ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080209125457.GA5686@basil.nowhere.org \
    --to=andi@firstfloor.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).