git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org
Subject: [JGIT PATCH 1/3] Make all files in our JAR have the same timestamp
Date: Tue,  2 Sep 2008 09:28:10 -0700	[thread overview]
Message-ID: <1220372892-15423-1-git-send-email-spearce@spearce.org> (raw)

When we link together our classes into a JAR we want to use the same
timestamp for all entries in the archive.  Using different times from
the local filesystem is fairly meaningless.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../org/spearce/jgit/pgm/build/JarLinkUtil.java    |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/build/JarLinkUtil.java b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/build/JarLinkUtil.java
index 46ae0ea..929ee55 100644
--- a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/build/JarLinkUtil.java
+++ b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/build/JarLinkUtil.java
@@ -93,6 +93,8 @@ public static void main(final String[] argv) throws IOException {
 
 	private final Map<String, File> chosenSources = new HashMap<String, File>();
 
+	private long creationTime;
+
 	private ZipOutputStream zos;
 
 	private JarLinkUtil() {
@@ -109,6 +111,7 @@ private void run() throws IOException {
 		for (final Map.Entry<String, String> e : files.entrySet())
 			chosenSources.put(e.getKey(), new File(e.getValue()));
 
+		creationTime = System.currentTimeMillis();
 		zos = new ZipOutputStream(System.out);
 		zos.setLevel(9);
 
@@ -180,9 +183,8 @@ else if (chosenSources.get(pfx + e.getName()) == rootDir)
 	private void appendFile(final File path, final String name)
 			throws IOException {
 		final long len = path.length();
-		final long time = path.lastModified();
 		final InputStream is = new FileInputStream(path);
-		appendEntry(name, len, time, is);
+		appendEntry(name, len, creationTime, is);
 	}
 
 	private void appendEntry(final String name, final long len,
-- 
1.6.0.1.207.g020e5

             reply	other threads:[~2008-09-02 16:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-02 16:28 Shawn O. Pearce [this message]
2008-09-02 16:28 ` [JGIT PATCH 2/3] Build jgit.jar and jgit_src.zip alongside jgit CLI wrapper Shawn O. Pearce
2008-09-02 16:28   ` [JGIT PATCH 3/3] Add a tiny "jgit version" program Shawn O. Pearce

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=1220372892-15423-1-git-send-email-spearce@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    /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).