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

[PATCH] import-zips: fix thinko

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 29, 2009, 20:42 UTC
Message-ID
<a66d575d61ccfe945467eed58fdb80a6b8350f5a.1238359324u.git.johannes.schindelin@gmx.de>
In-Reply-To
<cover.1238359324u.git.johannes.schindelin@gmx.de>

Embarrassingly, the common prefix calculation did not work properly, due to a mistake in the assignment: instead of assigning the dirname of the current file name, the dirname of the current common prefix needs to be assigned to common prefix, when the current prefix does not match the current file name.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 contrib/fast-import/import-zips.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/contrib/fast-import/import-zips.py b/contrib/fast-import/import-zips.py
index c674fa2..7051a83 100755
--- a/contrib/fast-import/import-zips.py
+++ b/contrib/fast-import/import-zips.py
@@ -44,7 +44,8 @@ for zipfile in argv[1:]:
 			common_prefix = name[:name.rfind('/') + 1]
 		else:
 			while not name.startswith(common_prefix):
-				common_prefix = name[:name.rfind('/') + 1]
+				last_slash = common_prefix[:-1].rfind('/') + 1
+				common_prefix = common_prefix[:last_slash]
 
 		mark[name] = ':' + str(next_mark)
 		next_mark += 1
-- 
1.6.2.1.493.g67cf3
Message 1 of 1 in “import-zips: fix thinko”
  1. import-zips: fix thinkoJohannes Schindelin, Mar 29, 2009

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.