git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: spearce@spearce.org, git@vger.kernel.org
Subject: Re: [PATCH] Add another fast-import example, this time for .zip files
Date: Mon, 30 Jun 2008 23:53:52 +0100 (BST)	[thread overview]
Message-ID: <alpine.DEB.1.00.0806302352370.9925@racer> (raw)
In-Reply-To: <alpine.DEB.1.00.0806301948130.9925@racer>

Hi,

On Mon, 30 Jun 2008, Johannes Schindelin wrote:

> 
> 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, \

      reply	other threads:[~2008-06-30 22:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-30 18:50 [PATCH] Add another fast-import example, this time for .zip files Johannes Schindelin
2008-06-30 22:53 ` Johannes Schindelin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.1.00.0806302352370.9925@racer \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).