Skip to content

Commit

Permalink
import-zips: fix thinko
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Mar 30, 2009
1 parent e8bd78c commit 63801da
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contrib/fast-import/import-zips.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def printlines(list):
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
Expand Down

0 comments on commit 63801da

Please sign in to comment.