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

Re: [PATCH] Add another fast-import example, this time for .zip files

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jun 30, 2008, 22:53 UTC
Message-ID
<alpine.DEB.1.00.0806302352370.9925@racer>
In-Reply-To
<alpine.DEB.1.00.0806301948130.9925@racer>
Hi,
On Mon, 30 Jun 2008, Johannes Schindelin wrote:
Show 5 quoted lines
> 
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> 
> 	I needed that today.

... and I needed that on top, which I forgot to commit, and therefore never sent in my first mail on this subject:

-- snipsnap --
diff --git a/contrib/fast-import/import-zip.py b/contrib/fast-import/import-zips.py
similarity index 85%
rename from contrib/fast-import/import-zip.py
rename to contrib/fast-import/import-zips.py
index 4200a66..fcf5823 100755
--- a/contrib/fast-import/import-zip.py
+++ b/contrib/fast-import/import-zips.py
@@ -40,6 +40,11 @@ for zipfile in argv[1:]:
 
 		if commit_time < info.date_time:
 			commit_time = info.date_time
+		if common_prefix == None:
+			common_prefix = name[:name.rfind('/') + 1]
+		else:
+			while not name.startswith(common_prefix):
+				common_prefix = name[:name.rfind('/') + 1]
 
 		mark[name] = ':' + str(next_mark)
 		next_mark += 1
@@ -56,7 +61,8 @@ for zipfile in argv[1:]:
 		'', 'deleteall'))
 
 	for name in mark.keys():
-		fast_import.write('M 100644 ' + mark[name] + ' ' + name + "\n")
+		fast_import.write('M 100644 ' + mark[name] + ' ' +
+			name[len(common_prefix):] + "\n")
 
 	printlines(('',  'tag ' + path.basename(zipfile), \
 		'from ' + branch_ref, 'tagger ' + committer, \
Previous: Johannes Schindelin
Message 2 of 2 in “Add another fast-import example, this time for .zip files”
  1. Add another fast-import example, this time for .zip filesJohannes Schindelin, Jun 30, 2008
  2. Johannes SchindelinJun 30, 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.