threads / patch / 18620

patchimport-zips: fix thinko

Subject: [PATCH] import-zips: fix thinko

## tl;dr

One message between Mar 29, 2009 and Mar 29, 2009. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Johannes Schindelin· Mar 29, 2009, 20:42 UTC · lore

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(-)
Show changes to contrib/fast-import/import-zips.py +2 −1
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

← back to recent threads