git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Ignore duplicated slashes in git-log

From
AKAndi Kleen <andi@firstfloor.org>
Date
Feb 9, 2008, 12:54 UTC
Message-ID
<20080209125457.GA5686@basil.nowhere.org>

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 != '.')
Next: Johannes Schindelin
Message 1 of 3 in “Ignore duplicated slashes in git-log”
  1. Ignore duplicated slashes in git-logAndi Kleen, Feb 9, 2008
  2. Johannes SchindelinFeb 9, 2008
  3. Andi KleenFeb 9, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.