Git development
 help / color / mirror / Atom feed
* [PATCH JGit] Adding update-server-info functionality try2
From: mr.gaffo @ 2009-09-16  0:48 UTC (permalink / raw)
  To: git

This patch series implements update-server-info functionality
in JGit and integrates it with ReceivePack so that repositories
hosted by git-http can also be hosted by JGit.

It also incorporates suggesions from RobinRosenberg.

Please be gentle.

^ permalink raw reply

* [PATCH JGit 2/5] Create abstract method on ObjectDatabase for accessing the list of local pack files.
From: mr.gaffo @ 2009-09-16  0:48 UTC (permalink / raw)
  To: git; +Cc: mike.gaffney, Mike Gaffney
In-Reply-To: <1253062116-13830-2-git-send-email-mr.gaffo@gmail.com>

From: mike.gaffney <mike.gaffney@asolutions.com>

Implemented the method for AlternateRepository database as a passthrough

Implemented the method for ObjectDirectory as a toList of the current
cached private PackList.

Hopefully this will allow easier reference to the list of packs for
others like the server side of fetch.

Signed-off-by: Mike Gaffney <mr.gaffo@gmail.com>
---
 .../org/spearce/jgit/lib/ObjectDirectoryTest.java  |   22 ++++++++++++++++++++
 .../tst/org/spearce/jgit/util/JGitTestUtil.java    |   21 ++++++++++++++++++-
 .../jgit/lib/AlternateRepositoryDatabase.java      |    6 +++++
 .../src/org/spearce/jgit/lib/ObjectDatabase.java   |   11 +++++++++-
 .../src/org/spearce/jgit/lib/ObjectDirectory.java  |    6 +++++
 5 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java
index 5b1fc0f..c27580f 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java
@@ -38,6 +38,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.List;
 import java.util.UUID;
 
 import org.spearce.jgit.util.JGitTestUtil;
@@ -45,6 +46,9 @@
 import junit.framework.TestCase;
 
 public class ObjectDirectoryTest extends TestCase {
+	private static final String PACK_NAME = "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f";
+	private static final File TEST_PACK = JGitTestUtil.getTestResourceFile(PACK_NAME + ".pack");
+	private static final File TEST_IDX = JGitTestUtil.getTestResourceFile(PACK_NAME + ".idx");
 	
 	private File testDir;
 
@@ -97,6 +101,24 @@ public void testGettingObjectFile() throws Exception {
 				 od.fileFor(ObjectId.fromString("b052a1272310d8df34de72f60204dee7e28a43d0")));
 	}
 	
+	public void testListLocalPacksNotCreated() throws Exception {
+		assertEquals(0, new ObjectDirectory(testDir).listLocalPacks().size());
+	}
+	
+	public void testListLocalPacksWhenThereIsAPack() throws Exception {
+		createTestDir();
+		File packsDir = new File(testDir, "pack");
+		packsDir.mkdirs();
+		
+		JGitTestUtil.copyFile(TEST_PACK, new File(packsDir, TEST_PACK.getName()));
+		JGitTestUtil.copyFile(TEST_IDX, new File(packsDir, TEST_IDX.getName()));
+
+		ObjectDirectory od = new ObjectDirectory(testDir);
+		List<PackFile> localPacks = od.listLocalPacks();
+		assertEquals(1, localPacks.size());
+		assertEquals(TEST_PACK.getName(), localPacks.get(0).getPackFile().getName());
+	}
+
 	private void createTestDir(){
 		if (!testDir.mkdir()){
 			fail("unable to create test directory");
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java b/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java
index 446c674..785922a 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java
@@ -38,6 +38,12 @@
 package org.spearce.jgit.util;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.net.URISyntaxException;
 import java.net.URL;
 
@@ -63,11 +69,24 @@ public static File getTestResourceFile(final String fileName) {
 		}
 		try {
 			return new File(url.toURI());
-		} catch(URISyntaxException e) {
+		} catch (URISyntaxException e) {
 			return new File(url.getPath());
 		}
 	}
 
+	public static void copyFile(final File fromFile, final File toFile) throws IOException {
+		InputStream in = new FileInputStream(fromFile);
+		OutputStream out = new FileOutputStream(toFile);
+
+		byte[] buf = new byte[1024];
+		int len;
+		while ((len = in.read(buf)) > 0) {
+			out.write(buf, 0, len);
+		}
+		in.close();
+		out.close();
+	}
+
 	private static ClassLoader cl() {
 		return JGitTestUtil.class.getClassLoader();
 	}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/AlternateRepositoryDatabase.java b/org.spearce.jgit/src/org/spearce/jgit/lib/AlternateRepositoryDatabase.java
index ee4c4cf..68ad488 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/AlternateRepositoryDatabase.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/AlternateRepositoryDatabase.java
@@ -39,6 +39,7 @@
 
 import java.io.IOException;
 import java.util.Collection;
+import java.util.List;
 
 /**
  * An ObjectDatabase of another {@link Repository}.
@@ -124,4 +125,9 @@ void openObjectInAllPacks1(final Collection<PackedObjectLoader> out,
 	protected void closeAlternates(final ObjectDatabase[] alt) {
 		// Do nothing; these belong to odb to close, not us.
 	}
+
+	@Override
+	public List<PackFile> listLocalPacks() {
+		return odb.listLocalPacks();
+	}
 }
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDatabase.java b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDatabase.java
index a547052..722c802 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDatabase.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDatabase.java
@@ -39,6 +39,7 @@
 
 import java.io.IOException;
 import java.util.Collection;
+import java.util.List;
 import java.util.concurrent.atomic.AtomicReference;
 
 /**
@@ -64,7 +65,15 @@
 	protected ObjectDatabase() {
 		alternates = new AtomicReference<ObjectDatabase[]>();
 	}
-
+	
+	/**
+	 * The list of Packs THIS repo contains
+	 * 
+	 * @return List<PackFile> of package names contained in this repo. 
+	 * 		   Should be an empty list if there are none.
+	 */
+	public abstract List<PackFile> listLocalPacks();
+	
 	/**
 	 * Does this database exist yet?
 	 *
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java
index 859824d..cbe132d 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java
@@ -508,4 +508,10 @@ boolean tryAgain(final long currLastModified) {
 			return true;
 		}
 	}
+
+	@Override
+	public List<PackFile> listLocalPacks() {
+		tryAgain1();
+		return new ArrayList<PackFile>(Arrays.asList(packList.get().packs));
+	}
 }
-- 
1.6.4.2

^ permalink raw reply related

* [PATCH JGit 1/5] adding tests for ObjectDirectory
From: mr.gaffo @ 2009-09-16  0:48 UTC (permalink / raw)
  To: git; +Cc: mike.gaffney, Mike Gaffney
In-Reply-To: <1253062116-13830-1-git-send-email-mr.gaffo@gmail.com>

From: mike.gaffney <mike.gaffney@asolutions.com>

Signed-off-by: Mike Gaffney <mr.gaffo@gmail.com>
---
 .../org/spearce/jgit/lib/ObjectDirectoryTest.java  |  106 ++++++++++++++++++++
 .../org/spearce/jgit/lib/RepositoryTestCase.java   |   58 +----------
 .../tst/org/spearce/jgit/util/JGitTestUtil.java    |   49 +++++++++
 3 files changed, 161 insertions(+), 52 deletions(-)
 create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java

diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java
new file mode 100644
index 0000000..5b1fc0f
--- /dev/null
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2009, Mike Gaffney.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials provided
+ *   with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ *   names of its contributors may be used to endorse or promote
+ *   products derived from this software without specific prior
+ *   written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.spearce.jgit.lib;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.UUID;
+
+import org.spearce.jgit.util.JGitTestUtil;
+
+import junit.framework.TestCase;
+
+public class ObjectDirectoryTest extends TestCase {
+	
+	private File testDir;
+
+	@Override
+	protected void setUp() throws Exception {
+		testDir = new File(new File(System.getProperty("java.io.tmpdir")), UUID.randomUUID().toString());
+	}
+	
+	@Override
+	protected void tearDown() throws Exception {
+		if (testDir.exists()){
+			JGitTestUtil.recursiveDelete(testDir, false, getClass().getName() + "." + getName(), true);
+		}
+	}
+
+	public void testCanGetDirectory() throws Exception {
+		ObjectDirectory od = new ObjectDirectory(testDir);
+		assertEquals(testDir, od.getDirectory());
+	}
+	
+	public void testExistsWithExistingDirectory() throws Exception {
+		createTestDir();
+		ObjectDirectory od = new ObjectDirectory(testDir);
+		assertTrue(od.exists());
+	}
+	
+	public void testExistsWithNonExistantDirectory() throws Exception {
+		assertFalse(new ObjectDirectory(new File("/some/nonexistant/file")).exists());
+	}
+	
+	public void testCreateMakesCorrectDirectories() throws Exception {
+		assertFalse(testDir.exists());
+		new ObjectDirectory(testDir).create();
+		assertTrue(testDir.exists());
+		
+		File infoDir = new File(testDir, "info");
+		assertTrue(infoDir.exists());
+		assertTrue(infoDir.isDirectory());
+		
+		File packDir = new File(testDir, "pack");
+		assertTrue(packDir.exists());
+		assertTrue(packDir.isDirectory());
+	}
+	
+	public void testGettingObjectFile() throws Exception {
+		ObjectDirectory od = new ObjectDirectory(testDir);
+		assertEquals(new File(testDir, "02/829ae153935095e4223f30cfc98c835de71bee"), 
+					 od.fileFor(ObjectId.fromString("02829ae153935095e4223f30cfc98c835de71bee")));
+		assertEquals(new File(testDir, "b0/52a1272310d8df34de72f60204dee7e28a43d0"), 
+				 od.fileFor(ObjectId.fromString("b052a1272310d8df34de72f60204dee7e28a43d0")));
+	}
+	
+	private void createTestDir(){
+		if (!testDir.mkdir()){
+			fail("unable to create test directory");
+		}
+	}
+	
+}
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java
index d1aef78..cfd7d25 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java
@@ -106,53 +106,7 @@ protected void configure() {
 	 * @param dir
 	 */
 	protected void recursiveDelete(final File dir) {
-		recursiveDelete(dir, false, getClass().getName() + "." + getName(), true);
-	}
-
-	protected static boolean recursiveDelete(final File dir, boolean silent,
-			final String name, boolean failOnError) {
-		assert !(silent && failOnError);
-		if (!dir.exists())
-			return silent;
-		final File[] ls = dir.listFiles();
-		if (ls != null) {
-			for (int k = 0; k < ls.length; k++) {
-				final File e = ls[k];
-				if (e.isDirectory()) {
-					silent = recursiveDelete(e, silent, name, failOnError);
-				} else {
-					if (!e.delete()) {
-						if (!silent) {
-							reportDeleteFailure(name, failOnError, e);
-						}
-						silent = !failOnError;
-					}
-				}
-			}
-		}
-		if (!dir.delete()) {
-			if (!silent) {
-				reportDeleteFailure(name, failOnError, dir);
-			}
-			silent = !failOnError;
-		}
-		return silent;
-	}
-
-	private static void reportDeleteFailure(final String name,
-			boolean failOnError, final File e) {
-		String severity;
-		if (failOnError)
-			severity = "Error";
-		else
-			severity = "Warning";
-		String msg = severity + ": Failed to delete " + e;
-		if (name != null)
-			msg += " in " + name;
-		if (failOnError)
-			fail(msg);
-		else
-			System.out.println(msg);
+		JGitTestUtil.recursiveDelete(dir, false, getClass().getName() + "." + getName(), true);
 	}
 
 	protected static void copyFile(final File src, final File dst)
@@ -215,7 +169,7 @@ public void setUp() throws Exception {
 		super.setUp();
 		configure();
 		final String name = getClass().getName() + "." + getName();
-		recursiveDelete(trashParent, true, name, false); // Cleanup old failed stuff
+		JGitTestUtil.recursiveDelete(trashParent, true, name, false); // Cleanup old failed stuff
 		trash = new File(trashParent,"trash"+System.currentTimeMillis()+"."+(testcount++));
 		trash_git = new File(trash, ".git").getCanonicalFile();
 		if (shutdownhook == null) {
@@ -230,7 +184,7 @@ public void run() {
 					System.gc();
 					for (Runnable r : shutDownCleanups)
 						r.run();
-					recursiveDelete(trashParent, false, null, false);
+					JGitTestUtil.recursiveDelete(trashParent, false, null, false);
 				}
 			};
 			Runtime.getRuntime().addShutdownHook(shutdownhook);
@@ -277,9 +231,9 @@ protected void tearDown() throws Exception {
 			System.gc();
 
 		final String name = getClass().getName() + "." + getName();
-		recursiveDelete(trash, false, name, true);
+		JGitTestUtil.recursiveDelete(trash, false, name, true);
 		for (Repository r : repositoriesToClose)
-			recursiveDelete(r.getWorkDir(), false, name, true);
+			JGitTestUtil.recursiveDelete(r.getWorkDir(), false, name, true);
 		repositoriesToClose.clear();
 
 		super.tearDown();
@@ -314,7 +268,7 @@ protected Repository createNewEmptyRepo(boolean bare) throws IOException {
 		final String name = getClass().getName() + "." + getName();
 		shutDownCleanups.add(new Runnable() {
 			public void run() {
-				recursiveDelete(newTestRepo, false, name, false);
+				JGitTestUtil.recursiveDelete(newTestRepo, false, name, false);
 			}
 		});
 		repositoriesToClose.add(newRepo);
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java b/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java
index eee0c14..446c674 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java
@@ -41,6 +41,9 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 
+import junit.framework.AssertionFailedError;
+
+
 public abstract class JGitTestUtil {
 	public static final String CLASSPATH_TO_RESOURCES = "org/spearce/jgit/test/resources/";
 
@@ -68,4 +71,50 @@ public static File getTestResourceFile(final String fileName) {
 	private static ClassLoader cl() {
 		return JGitTestUtil.class.getClassLoader();
 	}
+
+	public static boolean recursiveDelete(final File dir, boolean silent,
+			final String name, boolean failOnError) {
+		assert !(silent && failOnError);
+		if (!dir.exists())
+			return silent;
+		final File[] ls = dir.listFiles();
+		if (ls != null) {
+			for (int k = 0; k < ls.length; k++) {
+				final File e = ls[k];
+				if (e.isDirectory()) {
+					silent = recursiveDelete(e, silent, name, failOnError);
+				} else {
+					if (!e.delete()) {
+						if (!silent) {
+							JGitTestUtil.reportDeleteFailure(name, failOnError, e);
+						}
+						silent = !failOnError;
+					}
+				}
+			}
+		}
+		if (!dir.delete()) {
+			if (!silent) {
+				JGitTestUtil.reportDeleteFailure(name, failOnError, dir);
+			}
+			silent = !failOnError;
+		}
+		return silent;
+	}
+
+	private static void reportDeleteFailure(final String name,
+			boolean failOnError, final File e) {
+		String severity;
+		if (failOnError)
+			severity = "Error";
+		else
+			severity = "Warning";
+		String msg = severity + ": Failed to delete " + e;
+		if (name != null)
+			msg += " in " + name;
+		if (failOnError)
+			throw new AssertionFailedError(msg);
+		else
+			System.out.println(msg);
+	}
 }
-- 
1.6.4.2

^ permalink raw reply related

* Re: Git crashes on pull
From: Michael Wookey @ 2009-09-15 23:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Guido Ostkamp, git, Tay Ray Chuan
In-Reply-To: <7vzl8v4y5g.fsf@alter.siamese.dyndns.org>

2009/9/16 Junio C Hamano <gitster@pobox.com>:
> Guido Ostkamp <git@ostkamp.fastmail.fm> writes:
>
>> On Tue, 15 Sep 2009, Junio C Hamano wrote:
>>
>>> Please try this patch, which I have been preparing for later pushout.
>>>
>>> From: Junio C Hamano <gitster@pobox.com>
>>> Date: Mon, 14 Sep 2009 14:48:15 -0700
>>> Subject: [PATCH] http.c: avoid freeing an uninitialized pointer
>>>
>>> An earlier 59b8d38 (http.c: remove verification of remote packs) left
>>> the variable "url" uninitialized; "goto cleanup" codepath can free it
>>> which is not very nice.
>>>
>>> Signed-off-by: Junio C Hamano <gitster@pobox.com>
>>
>> Appears to be working ok now, thanks.
>
> Thanks.
>
> The sad part of the story was that this regression was introduced by a
> change to work around recent breakage observed when fetching from the http
> server github runs, and it was the primary purpose of pushing 1.6.4.3 out.

If only I had given it a run with the clang static analyzer earlier :(

Here is what Xcode would have shown -

    http://dl.getdropbox.com/u/1006983/git-clang.png

I can make the Xcode project available if anyone is interested.

^ permalink raw reply

* Re: Git crashes on pull
From: Junio C Hamano @ 2009-09-15 22:54 UTC (permalink / raw)
  To: Guido Ostkamp; +Cc: git, Tay Ray Chuan
In-Reply-To: <alpine.LSU.2.01.0909160022430.24554@bianca.dialin.t-online.de>

Guido Ostkamp <git@ostkamp.fastmail.fm> writes:

> On Tue, 15 Sep 2009, Junio C Hamano wrote:
>
>> Please try this patch, which I have been preparing for later pushout.
>>
>> From: Junio C Hamano <gitster@pobox.com>
>> Date: Mon, 14 Sep 2009 14:48:15 -0700
>> Subject: [PATCH] http.c: avoid freeing an uninitialized pointer
>>
>> An earlier 59b8d38 (http.c: remove verification of remote packs) left
>> the variable "url" uninitialized; "goto cleanup" codepath can free it
>> which is not very nice.
>>
>> Signed-off-by: Junio C Hamano <gitster@pobox.com>
>
> Appears to be working ok now, thanks.

Thanks.

The sad part of the story was that this regression was introduced by a
change to work around recent breakage observed when fetching from the http
server github runs, and it was the primary purpose of pushing 1.6.4.3 out.

Now we need to cut a 1.6.4.4 with this fix-on-fix soon, like tomorrow.

> BTW: Is there any way to easily invoke GDB in case of such a problem
> to get a real symbolic stack backtrace?
>
> I tried it on the 'git' binary, but of course this didn't work because
> it invokes a git-pull script which again runs another git-remote-curl
> binary.

Not very easily.  The best you can do is to run with GIT_TRACE to see what
command actually dies and run that binary directly.  gdb can choose to
follow either parent or child across forks, but I do not know how to tell
it to follow across execs into a different binary.

^ permalink raw reply

* Re: Commited to wrong branch
From: Björn Steinbrink @ 2009-09-15 22:30 UTC (permalink / raw)
  To: Martin Langhoff; +Cc: Howard Miller, git
In-Reply-To: <46a038f90909151453u5ead2eb5nebb46930a8e7277@mail.gmail.com>

On 2009.09.15 23:53:03 +0200, Martin Langhoff wrote:
> 2009/9/15 Björn Steinbrink <B.Steinbrink@gmx.de>:
> > Sooner or later you'll hit a merge conflict anyway, and conflict markers
> > aren't that hard to understand, and IMHO are easier to handle than .rej
> > files, as you get to edit everything in-place.
> 
> When git's diff3 gets confused trying to use ancestry, the conflict
> markers bring completely unrelated things that belong to the history
> of the file and not to the patch at hand.
> 
> It's not about the conflict markers but somewhat nonsensical proposed
> "sides" to the resolution.

That's not git getting confused trying to use the ancestry, but git
being unable to make use of the history. It has to use a fake common
ancestor, as using the true common ancestor would obviously mean that
you do a real merge, not a cherry-pick. Under some circumstances that
can lead to quite "interesting" conflicts, yeah, but IMHO still better
to deal with than those .rej files, especially when you switch to diff3
conflict marker mode (git checkout --conflict=diff3 -- file), which also
contains the version of the code that the "common ancestor" has.

> > Well, you likely shouldn't be using git-apply, which is plumbing, and
> > can't easily make use of the "index" information in git patches to do a
> > three-way merge instead of a "stupid" patch application. Instead use
> > git-am --3way to make git perform a three-way merge, leading to
> > conflicts instead of plain patch rejection.
> 
> Um, you got your internals wrong. git-apply is what git-am uses.

No, you didn't understand what I said. I said that _you_ shouldn't be
using git-apply. That "git am" internally uses "git apply" is a totally
different story. And with --3way, it doesn't even run just "git apply <
patch", but uses "git apply" just to build a fake common ancestor and
does a 3-way merge with git-merge-recursive.

Björn

^ permalink raw reply

* Re: Git crashes on pull
From: Guido Ostkamp @ 2009-09-15 22:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vljkg57xs.fsf@alter.siamese.dyndns.org>

On Tue, 15 Sep 2009, Junio C Hamano wrote:

> Please try this patch, which I have been preparing for later pushout.
>
> From: Junio C Hamano <gitster@pobox.com>
> Date: Mon, 14 Sep 2009 14:48:15 -0700
> Subject: [PATCH] http.c: avoid freeing an uninitialized pointer
>
> An earlier 59b8d38 (http.c: remove verification of remote packs) left
> the variable "url" uninitialized; "goto cleanup" codepath can free it
> which is not very nice.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Appears to be working ok now, thanks.

BTW: Is there any way to easily invoke GDB in case of such a problem to 
get a real symbolic stack backtrace?

I tried it on the 'git' binary, but of course this didn't work because it 
invokes a git-pull script which again runs another git-remote-curl binary.

Regards

Guido

^ permalink raw reply

* Re: Commited to wrong branch
From: Martin Langhoff @ 2009-09-15 21:53 UTC (permalink / raw)
  To: Björn Steinbrink; +Cc: Howard Miller, git
In-Reply-To: <20090915203948.GA14652@atjola.homenet>

2009/9/15 Björn Steinbrink <B.Steinbrink@gmx.de>:
> Sooner or later you'll hit a merge conflict anyway, and conflict markers
> aren't that hard to understand, and IMHO are easier to handle than .rej
> files, as you get to edit everything in-place.

When git's diff3 gets confused trying to use ancestry, the conflict
markers bring completely unrelated things that belong to the history
of the file and not to the patch at hand.

It's not about the conflict markers but somewhat nonsensical proposed
"sides" to the resolution.

> Well, you likely shouldn't be using git-apply, which is plumbing, and
> can't easily make use of the "index" information in git patches to do a
> three-way merge instead of a "stupid" patch application. Instead use
> git-am --3way to make git perform a three-way merge, leading to
> conflicts instead of plain patch rejection.

Um, you got your internals wrong. git-apply is what git-am uses.

cheers,



m
-- 
 martin.langhoff@gmail.com
 martin@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff

^ permalink raw reply

* Re: Commited to wrong branch
From: Howard Miller @ 2009-09-15 20:52 UTC (permalink / raw)
  To: Björn Steinbrink; +Cc: Martin Langhoff, git
In-Reply-To: <20090915203948.GA14652@atjola.homenet>

I don't imagine having a problem with conflict markers although I've
never had any in a git related project (yet!). I'm in the happy
position of working by myself at the moment which, in the end, is how
I got out of my problem because I knew where all the changes where.
Interestingly, the whole .rej file thing IS new to me. I've been using
patch files for years and have never had that happen before. Hmmm...

Never used emacs either - I'm a Vim-kid :-)

Martin's point about simply copying the repo so you have a backup is
at the same time dead simple and brilliant. It's almost an undo. I
have an idea that I could now fumble my way through a problem like
this. The bother is that git has too many commands and too little
(idiot proof) help which is a shame. Not everybody is a power user -
but we are just the sort of people who mess up. I'm trying to put a
positive spin on things - we need a git tips wiki or something.
Version control to me is a dull necessity - I don't want to have to
think about it!

Howard

2009/9/15 Björn Steinbrink <B.Steinbrink@gmx.de>:
> On 2009.09.15 15:54:58 +0200, Martin Langhoff wrote:
>> 2009/9/15 Björn Steinbrink <B.Steinbrink@gmx.de>:
>> > Just don't use patch(1), there's no sane reason to do that, you're
>> > sacrificing all of what git can offer there.
>>
>> Oh, yes there is, specially for newcomers used to patch, and how it
>> handles conflicts.
>
> Sooner or later you'll hit a merge conflict anyway, and conflict markers
> aren't that hard to understand, and IMHO are easier to handle than .rej
> files, as you get to edit everything in-place.
>
>> In this case, I happen to know that Howard is a refugee from CVS land
>> (the moodle project in this case), and he is familiar with the output
>> of patch if things go wrong.
>
> Uhm, CVS uses the same conflict markers that git uses.
>
>> It's not what I'd recommend to someone that is deep in git-land. But
>> even myself (with a bit of code in git) sometimes use patch when
>> git-apply tries to be too clever and I just want a damn .rej file to
>> review and edit with emacs.
>
> Well, you likely shouldn't be using git-apply, which is plumbing, and
> can't easily make use of the "index" information in git patches to do a
> three-way merge instead of a "stupid" patch application. Instead use
> git-am --3way to make git perform a three-way merge, leading to
> conflicts instead of plain patch rejection.
>
> And in a case like Howard's, in which nothing is coming from outside the
> repo, there's not even any reason to use am. It's already all in there,
> so "checkout -m", "stash/stash apply" (uncommitted changes) and
> "cherry-pick", "rebase [-i]" are way better than manually dealing with
> format-patch + am or even apply.
>
> Björn
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply

* Re: Commited to wrong branch
From: Björn Steinbrink @ 2009-09-15 20:39 UTC (permalink / raw)
  To: Martin Langhoff; +Cc: Howard Miller, git
In-Reply-To: <46a038f90909150654t73cab47ckfd02f8a2f4353722@mail.gmail.com>

On 2009.09.15 15:54:58 +0200, Martin Langhoff wrote:
> 2009/9/15 Björn Steinbrink <B.Steinbrink@gmx.de>:
> > Just don't use patch(1), there's no sane reason to do that, you're
> > sacrificing all of what git can offer there.
> 
> Oh, yes there is, specially for newcomers used to patch, and how it
> handles conflicts.

Sooner or later you'll hit a merge conflict anyway, and conflict markers
aren't that hard to understand, and IMHO are easier to handle than .rej
files, as you get to edit everything in-place.

> In this case, I happen to know that Howard is a refugee from CVS land
> (the moodle project in this case), and he is familiar with the output
> of patch if things go wrong.

Uhm, CVS uses the same conflict markers that git uses.

> It's not what I'd recommend to someone that is deep in git-land. But
> even myself (with a bit of code in git) sometimes use patch when
> git-apply tries to be too clever and I just want a damn .rej file to
> review and edit with emacs.

Well, you likely shouldn't be using git-apply, which is plumbing, and
can't easily make use of the "index" information in git patches to do a
three-way merge instead of a "stupid" patch application. Instead use
git-am --3way to make git perform a three-way merge, leading to
conflicts instead of plain patch rejection.

And in a case like Howard's, in which nothing is coming from outside the
repo, there's not even any reason to use am. It's already all in there,
so "checkout -m", "stash/stash apply" (uncommitted changes) and
"cherry-pick", "rebase [-i]" are way better than manually dealing with
format-patch + am or even apply.

Björn

^ permalink raw reply

* Re: [PATCH JGit 07/19] implemented the packs file update functionality
From: Robin Rosenberg @ 2009-09-15 19:23 UTC (permalink / raw)
  To: mr.gaffo; +Cc: git, mike.gaffney
In-Reply-To: <1252867475-858-8-git-send-email-mr.gaffo@gmail.com>

söndag 13 september 2009 20:44:23 skrev mr.gaffo@gmail.com:
> From: mike.gaffney <mike.gaffney@asolutions.com>
> 
> ---
>  .../jgit/lib/UpdateDirectoryInfoCacheTest.java     |   23 ++++++++++++++++++-
>  .../spearce/jgit/lib/UpdateDirectoryInfoCache.java |   17 +++++++++-----
>  2 files changed, 32 insertions(+), 8 deletions(-)
> 
> diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryInfoCacheTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryInfoCacheTest.java
> index 11d183e..25b78c5 100644
> --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryInfoCacheTest.java
> +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryInfoCacheTest.java
> @@ -1,11 +1,30 @@
>  package org.spearce.jgit.lib;
>  
> +import java.io.File;
> +import java.util.ArrayList;
> +import java.util.List;
> +
>  import junit.framework.TestCase;
>  
> +import org.spearce.jgit.util.JGitTestUtil;
> +
>  public class UpdateDirectoryInfoCacheTest extends TestCase {
> +	private static final String PACK_NAME = "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f";
> +	private static final File TEST_PACK = JGitTestUtil.getTestResourceFile(PACK_NAME + ".pack");
> +	private static final File TEST_IDX = JGitTestUtil.getTestResourceFile(PACK_NAME + ".idx");
>  	
> -	public void testBase() throws Exception {
> -		fail("nyi");
> +	public void testCreatesTheFileAndPutsTheContentsIn() throws Exception {
> +		List<PackFile> packs = new ArrayList<PackFile>();
> +		packs.add(new PackFile(TEST_IDX, TEST_PACK));
> +		
> +		File packsFile = File.createTempFile(UpdateDirectoryInfoCacheTest.class.getSimpleName(), "tstdata");
> +		packsFile.deleteOnExit();
> +		
> +		String expectedContents = new PacksFileContentsCreator(packs).toString();
> +		
> +		new UpdateDirectoryInfoCache(packs, packsFile).execute();
> +		
> +		assertEquals(expectedContents, JGitTestUtil.readFileAsString(packsFile));
>  	}
>  
>  }
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/UpdateDirectoryInfoCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/UpdateDirectoryInfoCache.java
> index 2bceb9e..72a315a 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/UpdateDirectoryInfoCache.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/UpdateDirectoryInfoCache.java
> @@ -1,22 +1,27 @@
>  package org.spearce.jgit.lib;
>  
> +import java.io.BufferedWriter;
>  import java.io.File;
> +import java.io.FileOutputStream;
> +import java.io.IOException;
>  import java.util.List;
>  
>  public class UpdateDirectoryInfoCache {
>  
>  	private List<PackFile> packsList;
> -	private File infoDirectory;
> +	private File infoPacksFile;
>  
>  	public UpdateDirectoryInfoCache(List<PackFile> packsList,
> -			File infoDirectory) {
> +									File infoPacksFile) {
>  		this.packsList = packsList;
> -		this.infoDirectory = infoDirectory;
> +		this.infoPacksFile = infoPacksFile;
>  	}
>  
> -	public void execute() {
> -//		File objectFile = objectDatabase.
> -//		String packsContents = new PacksFileContentsCreator(this.objectDatabase.listLocalPacks()).toString();
> +	public void execute() throws IOException {
> +		String packsContents = new PacksFileContentsCreator(packsList).toString();
> +		FileOutputStream fos = new FileOutputStream(infoPacksFile);
> +		fos.write(packsContents.getBytes());
> +		fos.close();
>  	}
>  
>  }

These cleanups could have been done by rewriting the patch set before submitting.

-- robin

^ permalink raw reply

* Re: [PATCH JGit 09/19] Didn't like the old name, this is more specific to it just updating the packs info cache
From: Robin Rosenberg @ 2009-09-15 19:23 UTC (permalink / raw)
  To: mr.gaffo; +Cc: git, mike.gaffney
In-Reply-To: <1252867475-858-10-git-send-email-mr.gaffo@gmail.com>


Ok, I stop reading here. Clean up and resubmit. Could you also set your real
in the patches name like the rest of us, i.e. Mike Gaffney instead of mike.gaffney
and add the Signed-Off-by and everything else mentioned in the SUBMITTING_PATCHES
document at the root of the JGit repo.

-- robin

^ permalink raw reply

* git-svn and rebasing refactored (moved) content
From: Halstrick, Christian @ 2009-09-15 16:11 UTC (permalink / raw)
  To: git@vger.kernel.org
In-Reply-To: <1252699129-6961-3-git-send-email-spearce@spearce.org>

Hi,

I have a question regarding git rebase operation when content was moved. I have
the problem when I transfer stuff from a subversion repo into my git repo, but
I wouldn't know the solution even if it would be a pure git scenario. Here is
the problem:

There is a SVN repository "Source" containing that files
"Source":
project/feat1/A.java
project/feat1/B.java
project/C.java

There is git repository "Target" where I work. That repository get's updates
from "Source" by 'git-svn migrate ...'. I had to move the files coming from
"Source" (using 'git mv'). I just moved but did not (and will not in future)
modify the files of "Source". Additionally I added my own new files. The state
of target is:
"Target":
project/src/feat1/A.java (renamed file)
project/src/feat1/B.java (renamed file)
project/src/C.java (renamed file)
project/pom.xml (created file)

Ideally from time to time I would like to rebase my work I do in "Target" on
the latest state of "Source". I use "git rebase ..." for that. But this
sometimes fails. If in "Source" files are only modified everything works fine.
E.g. modifications to "Source":project/feat1/A.java are visible in
"Target":project/src/feat1/A.java.  That's great!

But the rebase fails with conflicts when things are moved or deleted in
"Source". E.g. if "Source":project/feat1/A.java becomes
"Source":project/feat2/A.java and I merge that commit into my branch in
"Target" I get 

> CONFLICT (rename/rename): Rename
> "project/feat1/A.java"->"project/feat2/A.java" in branch "HEAD" rename
> "project/feat1/A.java"->"project/src/feat1/A.java " ...

I do understand the conflict but I am asking whether there is a better way to
use git so that I can get around these merge problems.

Ciao
  Chris

^ permalink raw reply

* Re: [PATCH 0/4] Colouring whitespace errors in diff -B output
From: Junio C Hamano @ 2009-09-15 20:12 UTC (permalink / raw)
  To: Nanako Shiraishi; +Cc: git
In-Reply-To: <20090915155209.6117@nanako3.lavabit.com>

Nanako Shiraishi <nanako3@lavabit.com> writes:

> Quoting Junio C Hamano <gitster@pobox.com>
>
>> The last one hooks "diff -B" logic to the per-line output routines in a
>> way that mimicks how the normal patches are fed to them better, in order
>> to take advantage of all the existing whitespace error detection and
>> colouring logic.
>>
>> Junio C Hamano (4):
>>       diff.c: shuffling code around
>>       diff.c: split emit_line() from the first char and the rest of the line
>>       diff.c: emit_add_line() takes only the rest of the line
>>       diff -B: colour whitespace errors
>>
>>  diff.c |  327 +++++++++++++++++++++++++++++++++++-----------------------------
>>  1 files changed, 180 insertions(+), 147 deletions(-)
>
> Sorry, but I don't seem to be able to apply these patches anywhere.

There is a subtle bug in "split emit_line()" patch I sent out, but later I
noticed the problem and fixed it in my tree, so please use the updated one
instead from my tree.

The series applies cleanly at the tip of jc/maint-1.6.0-blank-at-eof, but
the result of applying them will have large conflicts whether you are
merging that into 'maint', 'master', or 'next'.  It's probably easier to
use the merge I've prepared to resolve them in my tree.

I have these two topics:

 - jc/maint-1.6.0-blank-at-eof forks from old 1.6.0 codebase to contain
   the above fixes (and the ones that are already in 'next'); and

 - jc/maint-blank-at-eof that forks from 1.6.4 codebase and merges the
   above branch.  This branch does not have any commit on its own, but
   does a rather nasty conflict resolution.

I'll push out the result, merging the latter to 'next' (and 'pu'),
sometime in the next few hours.

^ permalink raw reply

* Re: Git crashes on pull
From: Junio C Hamano @ 2009-09-15 19:22 UTC (permalink / raw)
  To: Guido Ostkamp; +Cc: git
In-Reply-To: <alpine.LSU.2.01.0909152044450.10936@bianca.dialin.t-online.de>

Guido Ostkamp <git@ostkamp.fastmail.fm> writes:

> I have a clone of http://git.postgresql.org/git/postgresql.git where
> head is at commit 167501570c74390dfb7a5dd71e260ab3d4fd9904.
>
> I'm using Git version 1.6.5.rc1.10.g20f34 (should be at commit
> 20f34902d154f390ebaa7eed7f42ad14140b8acb from Mon Sep 14 10:49:01 2009
> +0200)
>
> Now when I 'git pull' then Git crashes with
>
> git pull 2>&1 > /tmp/git-error
> *** glibc detected *** git-remote-curl: free(): invalid pointer:

Please try this patch, which I have been preparing for later pushout.

From: Junio C Hamano <gitster@pobox.com>
Date: Mon, 14 Sep 2009 14:48:15 -0700
Subject: [PATCH] http.c: avoid freeing an uninitialized pointer

An earlier 59b8d38 (http.c: remove verification of remote packs) left
the variable "url" uninitialized; "goto cleanup" codepath can free it
which is not very nice.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 http.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/http.c b/http.c
index d0cc1b3..15926d8 100644
--- a/http.c
+++ b/http.c
@@ -866,7 +866,7 @@ static int fetch_pack_index(unsigned char *sha1, const char *base_url)
 	int ret = 0;
 	char *hex = xstrdup(sha1_to_hex(sha1));
 	char *filename;
-	char *url;
+	char *url = NULL;
 	struct strbuf buf = STRBUF_INIT;
 
 	if (has_pack_index(sha1)) {
-- 
1.6.5.rc1

^ permalink raw reply related

* Re: [PATCH 04/14] Set _O_BINARY as default fmode for both MinGW and MSVC
From: Marius Storm-Olsen @ 2009-09-15 19:12 UTC (permalink / raw)
  To: Alexey Borzenkov; +Cc: Johannes.Schindelin, msysgit, git, lznuaa, raa.lkml
In-Reply-To: <e2480c70909151207v4d89d302m27aecff0d4a11d45@mail.gmail.com>

Alexey Borzenkov said the following on 15.09.2009 21:07:
> GMail ate the bottom half of my message... again. :( Seems like 
> there's a strange bug in copy/pasting, I better compose long emails
> in TextMate from now on. Here's a "reconstruction":
> 
> On Tue, Sep 15, 2009 at 5:44 PM, Marius Storm-Olsen
> <mstormo@gmail.com> wrote:
>> +extern int _fmode;
> 
> And indeed. I just ported this patch to my custom msysgit branch 
> (based on v1.6.4.3) and it didn't compile:

Hmmm, I compile this fine with both MinGW from the msysgit 'devel' 
branch, and MSVC; but I see your point.

I'll give your updated patch a roll tomorrow. Thanks

--
.marius

^ permalink raw reply

* Re: [PATCH 04/14] Set _O_BINARY as default fmode for both MinGW and  MSVC
From: Alexey Borzenkov @ 2009-09-15 19:07 UTC (permalink / raw)
  To: Marius Storm-Olsen; +Cc: Johannes.Schindelin, msysgit, git, lznuaa, raa.lkml
In-Reply-To: <badc5d24387c28c752a45f75e8aec6bce64f81fe.1253021728.git.mstormo@gmail.com>

GMail ate the bottom half of my message... again. :( Seems like
there's a strange bug in copy/pasting, I better compose long emails in
TextMate from now on. Here's a "reconstruction":

On Tue, Sep 15, 2009 at 5:44 PM, Marius Storm-Olsen <mstormo@gmail.com> wrote:
> +extern int _fmode;

And indeed. I just ported this patch to my custom msysgit branch
(based on v1.6.4.3) and it didn't compile:

   CC git.o
cc1.exe: warnings being treated as errors
In file included from git-compat-util.h:116,
                from builtin.h:4,
                from git.c:1:
compat/mingw.h:243: error: '_fmode' redeclared without dllimport
attribute: previous dllimport ignored
git.c: In function 'main':
git.c:456: error: the address of '_iob' will always evaluate as 'true'
make: *** [git.o] Error 1

> +       if (stdin) \
> +               _setmode(_fileno(stdin), _O_BINARY); \
> +       if (stdout) \
> +               _setmode(_fileno(stdout), _O_BINARY); \
> +       if (stderr) \
> +               _setmode(_fileno(stderr), _O_BINARY); \

Also, at least mingw/gcc that is coming with msysgit thinks that
stdin/stdout/stderr always evaluate to true, and this check causes
problems as well. In the end, your patch should become something like
this:

diff --git a/compat/mingw.c b/compat/mingw.c
index fd642e4..807996c 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -5,7 +5,6 @@
 #include "../strbuf.h"

 extern int hide_dotfiles;
-unsigned int _CRT_fmode = _O_BINARY;

 static int err_win_to_posix(DWORD winerr)
 {
diff --git a/compat/mingw.h b/compat/mingw.h
index cfbcc0e..46473c5 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -244,6 +244,10 @@ char **env_setenv(char **env, const char *name);
 static int mingw_main(); \
 int main(int argc, const char **argv) \
 { \
+	_fmode = _O_BINARY; \
+	_setmode(_fileno(stdin), _O_BINARY); \
+	_setmode(_fileno(stdout), _O_BINARY); \
+	_setmode(_fileno(stderr), _O_BINARY); \
 	argv[0] = xstrdup(_pgmptr); \
 	return mingw_main(argc, argv); \
 } \

I can't check if it compiles with MSVC, but with msysgit it compiles
fine. Tests pass at least up to 3400 (haven't finished the rest).

^ permalink raw reply related

* Re: [PATCH 04/14] Set _O_BINARY as default fmode for both MinGW and  MSVC
From: Alexey Borzenkov @ 2009-09-15 19:01 UTC (permalink / raw)
  To: Marius Storm-Olsen; +Cc: Johannes.Schindelin, msysgit, git, lznuaa, raa.lkml
In-Reply-To: <badc5d24387c28c752a45f75e8aec6bce64f81fe.1253021728.git.mstormo@gmail.com>

On Tue, Sep 15, 2009 at 5:44 PM, Marius Storm-Olsen <mstormo@gmail.com> wrote:
> +extern int _fmode;

And indeed. I just ported this patch to my custom msysgit branch
(based on v1.6.4.3) and it didn't compile:

    CC git.o
cc1.exe: warnings being treated as errors
In file included from git-compat-util.h:116,
                 from builtin.h:4,
                 from git.c:1:
compat/mingw.h:243: error: '_fmode' redeclared without dllimport
attribute: previous dllimport ignored
git.c: In function 'main':
git.c:456: error: the address of '_iob' will always evaluate as 'true'
make: *** [git.o] Error 1

^ permalink raw reply

* Git crashes on pull
From: Guido Ostkamp @ 2009-09-15 18:47 UTC (permalink / raw)
  To: git

Hi,

I have a clone of http://git.postgresql.org/git/postgresql.git where head 
is at commit 167501570c74390dfb7a5dd71e260ab3d4fd9904.

I'm using Git version 1.6.5.rc1.10.g20f34 (should be at commit 
20f34902d154f390ebaa7eed7f42ad14140b8acb from Mon Sep 14 10:49:01 2009 
+0200)

Now when I 'git pull' then Git crashes with

git pull 2>&1 > /tmp/git-error
*** glibc detected *** git-remote-curl: free(): invalid pointer: 
0xb7d19140 ***
======= Backtrace: =========
/lib/libc.so.6[0xb7c4f4b6]
/lib/libc.so.6(cfree+0x89)[0xb7c51179]
git-remote-curl[0x804d290]
git-remote-curl[0x804df04]
git-remote-curl[0x8065ea5]
git-remote-curl[0x804aac6]
/lib/libc.so.6(__libc_start_main+0xe0)[0xb7bfefe0]
git-remote-curl[0x804a991]
======= Memory map: ========
08048000-080a1000 r-xp 00000000 08:15 1658246 
/usr/local/libexec/git-core/git-remote-curl
080a1000-080a2000 r--p 00058000 08:15 1658246 
/usr/local/libexec/git-core/git-remote-curl
080a2000-080a3000 rw-p 00059000 08:15 1658246 
/usr/local/libexec/git-core/git-remote-curl
080a3000-08143000 rw-p 080a3000 00:00 0          [heap]
b4400000-b4421000 rw-p b4400000 00:00 0
b4421000-b4500000 ---p b4421000 00:00 0
b45ea000-b45f4000 r-xp 00000000 08:13 1097821    /lib/libgcc_s.so.1
b45f4000-b45f6000 rw-p 00009000 08:13 1097821    /lib/libgcc_s.so.1
...

Any idea what's causing this?

Please keep me on CC, as I'm not subscribed on list.

Regards

Guido

^ permalink raw reply

* Re: [PATCH 04/14] Set _O_BINARY as default fmode for both MinGW and  MSVC
From: Alexey Borzenkov @ 2009-09-15 18:40 UTC (permalink / raw)
  To: Marius Storm-Olsen; +Cc: Johannes.Schindelin, msysgit, git, lznuaa, raa.lkml
In-Reply-To: <badc5d24387c28c752a45f75e8aec6bce64f81fe.1253021728.git.mstormo@gmail.com>

On Tue, Sep 15, 2009 at 5:44 PM, Marius Storm-Olsen <mstormo@gmail.com> wrote:
> +extern int _fmode;

Is it really needed? I might be wrong, but I thought _fmode needed a
more complex declaration, at least on mingw, for which you are
supposed to include stdlib.h. For example, for mingw, in stdlib.h, it
is declared this way:

#if !defined (__DECLSPEC_SUPPORTED) || defined (__IN_MINGW_RUNTIME)

#ifdef __MSVCRT__
extern int* _imp___fmode;
#define	_fmode	(*_imp___fmode)
#else
/* CRTDLL */
extern int* _imp___fmode_dll;
#define	_fmode	(*_imp___fmode_dll)
#endif

#else /* __DECLSPEC_SUPPORTED */

#ifdef __MSVCRT__
__MINGW_IMPORT  int _fmode;
#else /* ! __MSVCRT__ */
__MINGW_IMPORT  int _fmode_dll;
#define	_fmode	_fmode_dll
#endif /* ! __MSVCRT__ */

#endif /* __DECLSPEC_SUPPORTED */

As you can see it is a little more complex than a simple extern (e.g.
it uses __declspec(dllimport) when it is supported, and a bit of
manual dereferencing otherwise). So maybe you would just include
stdlib.h and use definition from there?

^ permalink raw reply

* Re: Pair Programming Workflow Suggestions
From: Jakub Narebski @ 2009-09-15 18:20 UTC (permalink / raw)
  To: Tim Visher; +Cc: Git Mailing List
In-Reply-To: <c115fd3c0909151043v3216a147v35e18710fbead515@mail.gmail.com>

Tim Visher <tim.visher@gmail.com> writes:

> I'm interested in hearing how people use Git for pair programming.
> Specifically, how do you document that you are programming in pairs.

[...]

> I did find Brian Helmkamp's script
> http://www.brynary.com/2008/9/1/setting-the-git-commit-author-to-pair-programmers-names
> but that's not really what I'm looking for. [...]

I'm not sure if this would help you, but take a look at "Pair
Programming & git & github & Gravatar & You & You" blog post by Jon
"Lark" Larkowski from May 30, 2009:

  http://blog.l4rk.com/2009/05/pair-programming-git-github-gravatar.html

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply

* Re: Pair Programming Workflow Suggestions
From: Sean Estabrooks @ 2009-09-15 18:14 UTC (permalink / raw)
  To: Tim Visher; +Cc: Git Mailing List
In-Reply-To: <c115fd3c0909151043v3216a147v35e18710fbead515@mail.gmail.com>

On Tue, 15 Sep 2009 13:43:17 -0400
Tim Visher <tim.visher@gmail.com> wrote:

[...]
> It would be nicer to
> have an arbitrary number of authors that can all exist separately, but
> I'm fairly certain that git does not support that.

Tim,

If you're just looking for a way to quickly switch the author information
quickly between individual commits.  You could create a shell alias for
each of the programmers that does:

   export GIT_AUTHOR_NAME="some name" GIT_AUTHOR_EMAIL="name@where.com"

This will override the global and per repo configured author information
for all subsequent commits.

HTH,
Sean

^ permalink raw reply

* Pair Programming Workflow Suggestions
From: Tim Visher @ 2009-09-15 17:43 UTC (permalink / raw)
  To: Git Mailing List

Hello Everyone,

I'm interested in hearing how people use Git for pair programming.
Specifically, how do you document that you are programming in pairs.
Typically, of course, you have a driver and a navigator.  It seems
natural to have a commit's author be the driver at the time, but that
doesn't seem to do justice to what pair programming is.  Really, both
people are normally coding, but one person is doing the typing and
most of the thinking while the other is acting as an in place code
reviewer.  There are even cases where there's a third person involved.

I did find [Brian Helmkamp's
script](http://www.brynary.com/2008/9/1/setting-the-git-commit-author-to-pair-programmers-names)
but that's not really what I'm looking for.  For instance, that would
break the nice integration we have with Hudson at this point for
displaying when a developer was last active.  It would be nicer to
have an arbitrary number of authors that can all exist separately, but
I'm fairly certain that git does not support that.

Thoughts?


-- 

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

^ permalink raw reply

* Re: [PATCH JGit 05/19] Made tests for listLocalPacks function on ObjectDirectory and made them pass
From: Robin Rosenberg @ 2009-09-15 16:13 UTC (permalink / raw)
  To: mr.gaffo; +Cc: git, mike.gaffney
In-Reply-To: <1252867475-858-6-git-send-email-mr.gaffo@gmail.com>

söndag 13 september 2009 20:44:21 skrev mr.gaffo@gmail.com:
> From: mike.gaffney <mike.gaffney@asolutions.com>
> 
> ---
>  .../org/spearce/jgit/lib/ObjectDirectoryTest.java  |   24 ++++++++++++++++++++
>  .../jgit/lib/UpdateDirectoryInfoCacheTest.java     |   11 +++++++++
>  .../tst/org/spearce/jgit/util/JGitTestUtil.java    |   21 ++++++++++++++++-
>  .../src/org/spearce/jgit/lib/ObjectDirectory.java  |    6 +++++
>  .../spearce/jgit/lib/UpdateDirectoryInfoCache.java |   22 ++++++++++++++++++
>  5 files changed, 83 insertions(+), 1 deletions(-)
>  create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryInfoCacheTest.java
>  create mode 100644 org.spearce.jgit/src/org/spearce/jgit/lib/UpdateDirectoryInfoCache.java
> 
> diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java
> index fe019af..8e4d8e5 100644
> --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java
> +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java
> @@ -1,11 +1,17 @@
>  package org.spearce.jgit.lib;
>  
>  import java.io.File;
> +import java.util.List;
>  import java.util.UUID;
>  
> +import org.spearce.jgit.util.JGitTestUtil;
> +
>  import junit.framework.TestCase;
>  
>  public class ObjectDirectoryTest extends TestCase {
> +	private static final String PACK_NAME = "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f";
> +	private static final File TEST_PACK = JGitTestUtil.getTestResourceFile(PACK_NAME + ".pack");
> +	private static final File TEST_IDX = JGitTestUtil.getTestResourceFile(PACK_NAME + ".idx");
>  	
>  	private File testDir;
>  
> @@ -58,6 +64,24 @@ public void testGettingObjectFile() throws Exception {
>  				 od.fileFor(ObjectId.fromString("b052a1272310d8df34de72f60204dee7e28a43d0")));
>  	}
>  	
> +	public void testListLocalPacksNotCreated() throws Exception {
> +		assertEquals(0, new ObjectDirectory(testDir).listLocalPacks().size());
> +	}
> +	
> +	public void testListLocalPacksWhenThereIsAPack() throws Exception {
> +		createTestDir();
> +		File packsDir = new File(testDir, "pack");
> +		packsDir.mkdirs();
> +		
> +		JGitTestUtil.copyFile(TEST_PACK, new File(packsDir, TEST_PACK.getName()));
> +		JGitTestUtil.copyFile(TEST_IDX, new File(packsDir, TEST_IDX.getName()));
> +
> +		ObjectDirectory od = new ObjectDirectory(testDir);
> +		List<PackFile> localPacks = od.listLocalPacks();
> +		assertEquals(1, localPacks.size());
> +		assertEquals(TEST_PACK.getName(), localPacks.get(0).getPackFile().getName());
> +	}
> +	
>  	public boolean deleteDir(File dir) {
>          if (dir.isDirectory()) {
>              String[] children = dir.list();
> diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryInfoCacheTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryInfoCacheTest.java
> new file mode 100644
> index 0000000..11d183e
> --- /dev/null
> +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryInfoCacheTest.java
> @@ -0,0 +1,11 @@
> +package org.spearce.jgit.lib;
> +
> +import junit.framework.TestCase;
> +
> +public class UpdateDirectoryInfoCacheTest extends TestCase {
> +	
> +	public void testBase() throws Exception {
> +		fail("nyi");
> +	}
> +
> +}
> diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java b/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java
> index eee0c14..04184d7 100644
> --- a/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java
> +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java
> @@ -38,6 +38,12 @@
>  package org.spearce.jgit.util;
>  
>  import java.io.File;
> +import java.io.FileInputStream;
> +import java.io.FileNotFoundException;
> +import java.io.FileOutputStream;
> +import java.io.IOException;
> +import java.io.InputStream;
> +import java.io.OutputStream;
>  import java.net.URISyntaxException;
>  import java.net.URL;
>  
> @@ -60,11 +66,24 @@ public static File getTestResourceFile(final String fileName) {
>  		}
>  		try {
>  			return new File(url.toURI());
> -		} catch(URISyntaxException e) {
> +		} catch (URISyntaxException e) {
>  			return new File(url.getPath());
>  		}
>  	}
>  
> +	public static void copyFile(final File fromFile, final File toFile) throws IOException {
> +		InputStream in = new FileInputStream(fromFile);
> +		OutputStream out = new FileOutputStream(toFile);
> +
> +		byte[] buf = new byte[1024];
> +		int len;
> +		while ((len = in.read(buf)) > 0) {
> +			out.write(buf, 0, len);
> +		}
> +		in.close();
> +		out.close();
> +	}

You need to check for short reads, i.e. read could retrieve
fewer bytes than requested, Less important, a larger buffer size could
perhaps be used too (like 8192 which is the default BufferedReader buffer size).

>  	private static ClassLoader cl() {
>  		return JGitTestUtil.class.getClassLoader();
>  	}
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java
> index fe219c6..a90ae00 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java
> @@ -511,6 +511,12 @@ boolean tryAgain(final long currLastModified) {
>  
>  	@Override
>  	public List<PackFile> listLocalPacks() {
> +		tryAgain1();
mmmm. probably good.

> +	public void execute() {
> +//		File objectFile = objectDatabase.
> +//		String packsContents = new PacksFileContentsCreator(this.objectDatabase.listLocalPacks()).toString();

Out commented code is a no-no.

-- robin

^ permalink raw reply

* Re: [PATCH 1/2] Work around leftover temporary save file.
From: Pat Thoyts @ 2009-09-15 15:44 UTC (permalink / raw)
  To: Alexey Borzenkov; +Cc: Alex Riesen, git, Paul Mackerras
In-Reply-To: <e2480c70909150714n3b7d6018rcb5bcb42d1d78218@mail.gmail.com>

Alexey Borzenkov <snaury@gmail.com> writes:

>
>Then deleting would fail, because on Windows opened files cannot be
>deleted (unless they are opened in a special way that permits it).
>

The delete occurs before we attempt to open the file which is why it
succeeds when such file is present.

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox