]> git.ipfire.org Git - thirdparty/git.git/commitdiff
import-zips: fix thinko
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sun, 29 Mar 2009 20:42:27 +0000 (22:42 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Mar 2009 02:56:26 +0000 (19:56 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/fast-import/import-zips.py

index c674fa2d1b5c6ab47ebb5e828c427c6d47bb50fc..7051a83a59758277dd60fe026dea730eb7b6b115 100755 (executable)
@@ -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