From 63a1f810a6f976a307aaaabdce21082f6d7f20aa Mon Sep 17 00:00:00 2001
From: Steffen Prohaska <prohaska@zib.de>
Date: Tue, 2 Oct 2007 08:14:37 +0200
Subject: [PATCH 01/15] fixed link in documentation of diff-options

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/diff-options.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 228ccaf10ab..b1f528ae886 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -179,8 +179,8 @@
 
 --ext-diff::
 	Allow an external diff helper to be executed. If you set an
-	external diff driver with gitlink:gitattributes(5), you need
-	to use this option with gitlink:git-log(1) and friends.
+	external diff driver with gitlink:gitattributes[5], you need
+	to use this option with gitlink:git-log[1] and friends.
 
 --no-ext-diff::
 	Disallow external diff drivers.

From c8f203255bc7a782e3a54e73d5801009bb7f0319 Mon Sep 17 00:00:00 2001
From: Junio C Hamano <gitster@pobox.com>
Date: Tue, 2 Oct 2007 11:47:58 -0700
Subject: [PATCH 02/15] git-commit: initialize TMP_INDEX just to be sure.

We rely on TMP_INDEX variable to decide if we are doing a partial commit,
as it is only set in the partial commit codepath.  But the variable is
never initialized.  A stray environment variable from outside could
ruin the day.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-commit.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/git-commit.sh b/git-commit.sh
index 7a7a2cb4b47..ab43217be4b 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -25,6 +25,7 @@ refuse_partial () {
 	exit 1
 }
 
+TMP_INDEX=
 THIS_INDEX="$GIT_DIR/index"
 NEXT_INDEX="$GIT_DIR/next-index$$"
 rm -f "$NEXT_INDEX"

From 9e1a2acfb2198e29c90b59eef84eb0370ef9f03f Mon Sep 17 00:00:00 2001
From: Junio C Hamano <gitster@pobox.com>
Date: Tue, 2 Oct 2007 15:09:41 -0700
Subject: [PATCH 03/15] for-each-ref: fix %(numparent) and %(parent)

The string value of %(numparent) was not returned correctly.
Also %(parent) misbehaved for the root commits (returned garbage)
and merge commits (returned first parent, followed by a space).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin-for-each-ref.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index 0afa1c5c41e..29f70aabc3f 100644
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
@@ -43,7 +43,7 @@ static struct {
 	{ "objectsize", FIELD_ULONG },
 	{ "objectname" },
 	{ "tree" },
-	{ "parent" }, /* NEEDSWORK: how to address 2nd and later parents? */
+	{ "parent" },
 	{ "numparent", FIELD_ULONG },
 	{ "object" },
 	{ "type" },
@@ -262,24 +262,26 @@ static void grab_commit_values(struct atom_value *val, int deref, struct object
 		}
 		if (!strcmp(name, "numparent")) {
 			char *s = xmalloc(40);
+			v->ul = num_parents(commit);
 			sprintf(s, "%lu", v->ul);
 			v->s = s;
-			v->ul = num_parents(commit);
 		}
 		else if (!strcmp(name, "parent")) {
 			int num = num_parents(commit);
 			int i;
 			struct commit_list *parents;
-			char *s = xmalloc(42 * num);
+			char *s = xmalloc(41 * num + 1);
 			v->s = s;
 			for (i = 0, parents = commit->parents;
 			     parents;
-			     parents = parents->next, i = i + 42) {
+			     parents = parents->next, i = i + 41) {
 				struct commit *parent = parents->item;
 				strcpy(s+i, sha1_to_hex(parent->object.sha1));
 				if (parents->next)
 					s[i+40] = ' ';
 			}
+			if (!i)
+				*s = '\0';
 		}
 	}
 }

From 6ea9c7eb2713d55f9af7522e878e6912972bb889 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Date: Tue, 2 Oct 2007 21:14:30 +0100
Subject: [PATCH 04/15] Fix typo in config.txt

There was an 'l' (ell) instead of a '1' (one) in one of the gitlinks.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/config.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 866e0534b88..7ee97df8a70 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -579,7 +579,7 @@ merge.summary::
 
 merge.tool::
 	Controls which merge resolution program is used by
-	gitlink:git-mergetool[l].  Valid values are: "kdiff3", "tkdiff",
+	gitlink:git-mergetool[1].  Valid values are: "kdiff3", "tkdiff",
 	"meld", "xxdiff", "emerge", "vimdiff", "gvimdiff", and "opendiff".
 
 merge.verbosity::

From ac150747d7cc62d53daf9f7c128a0fa88a399f44 Mon Sep 17 00:00:00 2001
From: Federico Mena Quintero <federico@novell.com>
Date: Tue, 2 Oct 2007 18:32:32 -0500
Subject: [PATCH 05/15] Say when --track is useful in the git-checkout docs.

The documentation used to say what the option does, but it
didn't mention a use case.

Signed-off-by: Federico Mena Quintero <federico@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/git-checkout.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 734928bf96c..2e58481ed68 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -50,7 +50,9 @@ OPTIONS
 --track::
 	When -b is given and a branch is created off a remote branch,
 	set up configuration so that git-pull will automatically
-	retrieve data from the remote branch.  Set the
+	retrieve data from the remote branch.  Use this if you always
+	pull from the same remote branch into the new branch, or if you
+	don't want to use "git pull <repository> <refspec>" explicitly.  Set the
 	branch.autosetupmerge configuration variable to true if you
 	want git-checkout and git-branch to always behave as if
 	'--track' were given.

From 84d176cef65ad23e11643d463c69ad313b728eda Mon Sep 17 00:00:00 2001
From: Federico Mena Quintero <federico@novell.com>
Date: Tue, 2 Oct 2007 18:33:30 -0500
Subject: [PATCH 06/15] Add documentation for --track and --no-track to the
 git-branch docs.

Signed-off-by: Federico Mena Quintero <federico@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/git-branch.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index 33bc31b0d44..c8399614943 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -91,6 +91,21 @@ OPTIONS
 --no-abbrev::
 	Display the full sha1s in output listing rather than abbreviating them.
 
+--track::
+	Set up configuration so that git-pull will automatically
+	retrieve data from the remote branch.  Use this if you always
+	pull from the same remote branch into the new branch, or if you
+	don't want to use "git pull <repository> <refspec>" explicitly.  Set the
+	branch.autosetupmerge configuration variable to true if you
+	want git-checkout and git-branch to always behave as if
+	'--track' were given.
+
+--no-track::
+	When -b is given and a branch is created off a remote branch,
+	set up configuration so that git-pull will not retrieve data
+	from the remote branch, ignoring the branch.autosetupmerge
+	configuration variable.
+
 <branchname>::
 	The name of the branch to create or delete.
 	The new branch name must pass all checks defined by

From 46749204e97290a0bf20e988d0356f0daba99347 Mon Sep 17 00:00:00 2001
From: Federico Mena Quintero <federico@novell.com>
Date: Tue, 2 Oct 2007 18:34:32 -0500
Subject: [PATCH 07/15] Note that git-branch will not automatically checkout
 the new branch

Signed-off-by: Federico Mena Quintero <federico@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/git-branch.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index c8399614943..b7285bcdbc8 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -26,6 +26,10 @@ It will start out with a head equal to the one given as <start-point>.
 If no <start-point> is given, the branch will be created with a head
 equal to that of the currently checked out branch.
 
+Note that this will create the new branch, but it will not switch the
+working tree to it; use "git checkout <newbranch>" to switch to the
+new branch.
+
 When a local branch is started off a remote branch, git can setup the
 branch so that gitlink:git-pull[1] will appropriately merge from that
 remote branch.  If this behavior is desired, it is possible to make it

From 8fc293cb1e639c9ea555a8e95e3a7801fc1d1be8 Mon Sep 17 00:00:00 2001
From: Federico Mena Quintero <federico@novell.com>
Date: Tue, 2 Oct 2007 18:36:30 -0500
Subject: [PATCH 08/15] Make git-pull complain and give advice when there is
 nothing to merge with

Signed-off-by: Federico Mena Quintero <federico@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-pull.sh | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/git-pull.sh b/git-pull.sh
index c3f05f56de3..74bfc16744d 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -97,10 +97,24 @@ case "$merge_head" in
 	esac
 	curr_branch=${curr_branch#refs/heads/}
 
-	echo >&2 "Warning: No merge candidate found because value of config option
-         \"branch.${curr_branch}.merge\" does not match any remote branch fetched."
-	echo >&2 "No changes."
-	exit 0
+	echo >&2 "You asked me to pull without telling me which branch you"
+	echo >&2 "want to merge with, and 'branch.${curr_branch}.merge' in"
+	echo >&2 "your configuration file does not tell me either.  Please"
+	echo >&2 "name which branch you want to merge on the command line and"
+	echo >&2 "try again (e.g. 'git pull <repository> <refspec>')."
+	echo >&2 "See git-pull(1) for details on the refspec."
+	echo >&2
+	echo >&2 "If you often merge with the same branch, you may want to"
+	echo >&2 "configure the following variables in your configuration"
+	echo >&2 "file:"
+	echo >&2
+	echo >&2 "    branch.${curr_branch}.remote = <nickname>"
+	echo >&2 "    branch.${curr_branch}.merge = <remote-ref>"
+	echo >&2 "    remote.<nickname>.url = <url>"
+	echo >&2 "    remote.<nickname>.fetch = <refspec>"
+	echo >&2
+	echo >&2 "See git-config(1) for details."
+	exit 1
 	;;
 ?*' '?*)
 	if test -z "$orig_head"

From 2ff5e18a930ddaf03c77a60e52648e7b8b20fc8d Mon Sep 17 00:00:00 2001
From: Johan Herland <johan@herland.net>
Date: Wed, 3 Oct 2007 01:42:29 +0200
Subject: [PATCH 09/15] Mention 'cpio' dependency in INSTALL

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 INSTALL | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/INSTALL b/INSTALL
index 289b046a443..f1eb4049b9f 100644
--- a/INSTALL
+++ b/INSTALL
@@ -79,6 +79,9 @@ Issues of note:
 	- "perl" and POSIX-compliant shells are needed to use most of
 	  the barebone Porcelainish scripts.
 
+	- "cpio" is used by git-merge for saving and restoring the index,
+	  and by git-clone when doing a local (possibly hardlinked) clone.
+
  - Some platform specific issues are dealt with Makefile rules,
    but depending on your specific installation, you may not
    have all the libraries/tools needed, or you may have

From eede7b7d110e2c354235d7a3f6c8f1644b5120e5 Mon Sep 17 00:00:00 2001
From: Jeff King <peff@peff.net>
Date: Tue, 25 Sep 2007 15:29:42 -0400
Subject: [PATCH 10/15] diffcore-rename: cache file deltas

We find rename candidates by computing a fingerprint hash of
each file, and then comparing those fingerprints. There are
inherently O(n^2) comparisons, so it pays in CPU time to
hoist the (rather expensive) computation of the fingerprint
out of that loop (or to cache it once we have computed it once).

Previously, we didn't keep the filespec information around
because then we had the potential to consume a great deal of
memory. However, instead of keeping all of the filespec
data, we can instead just keep the fingerprint.

This patch implements and uses diff_free_filespec_data_large
to accomplish that goal. We also have to change
estimate_similarity not to needlessly repopulate the
filespec data when we already have the hash.

Practical tests showed 4.5x speedup for a 10% memory usage
increase.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 diff.c            | 7 ++++++-
 diffcore-rename.c | 7 ++++---
 diffcore.h        | 1 +
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/diff.c b/diff.c
index 0ee9ea1c1b4..35e3c619864 100644
--- a/diff.c
+++ b/diff.c
@@ -1675,7 +1675,7 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
 	return 0;
 }
 
-void diff_free_filespec_data(struct diff_filespec *s)
+void diff_free_filespec_data_large(struct diff_filespec *s)
 {
 	if (s->should_free)
 		free(s->data);
@@ -1686,6 +1686,11 @@ void diff_free_filespec_data(struct diff_filespec *s)
 		s->should_free = s->should_munmap = 0;
 		s->data = NULL;
 	}
+}
+
+void diff_free_filespec_data(struct diff_filespec *s)
+{
+	diff_free_filespec_data_large(s);
 	free(s->cnt_data);
 	s->cnt_data = NULL;
 }
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 41b35c3a9e6..4fc200064ae 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -184,7 +184,8 @@ static int estimate_similarity(struct diff_filespec *src,
 	if (base_size * (MAX_SCORE-minimum_score) < delta_size * MAX_SCORE)
 		return 0;
 
-	if (diff_populate_filespec(src, 0) || diff_populate_filespec(dst, 0))
+	if ((!src->cnt_data && diff_populate_filespec(src, 0))
+		|| (!dst->cnt_data && diff_populate_filespec(dst, 0)))
 		return 0; /* error but caught downstream */
 
 
@@ -377,10 +378,10 @@ void diffcore_rename(struct diff_options *options)
 			m->score = estimate_similarity(one, two,
 						       minimum_score);
 			m->name_score = basename_same(one, two);
-			diff_free_filespec_data(one);
+			diff_free_filespec_data_large(one);
 		}
 		/* We do not need the text anymore */
-		diff_free_filespec_data(two);
+		diff_free_filespec_data_large(two);
 		dst_cnt++;
 	}
 	/* cost matrix sorted by most to least similar pair */
diff --git a/diffcore.h b/diffcore.h
index eef17c4ca2e..4bf175bda99 100644
--- a/diffcore.h
+++ b/diffcore.h
@@ -48,6 +48,7 @@ extern void fill_filespec(struct diff_filespec *, const unsigned char *,
 
 extern int diff_populate_filespec(struct diff_filespec *, int);
 extern void diff_free_filespec_data(struct diff_filespec *);
+extern void diff_free_filespec_data_large(struct diff_filespec *);
 extern int diff_filespec_is_binary(struct diff_filespec *);
 
 struct diff_filepair {

From 8ae92e63895000ff9b12046325ae381f3c17d414 Mon Sep 17 00:00:00 2001
From: Junio C Hamano <gitster@pobox.com>
Date: Tue, 2 Oct 2007 21:01:03 -0700
Subject: [PATCH 11/15] rename diff_free_filespec_data_large() to
 diff_free_filespec_blob()

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 diff.c            | 4 ++--
 diffcore-rename.c | 4 ++--
 diffcore.h        | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/diff.c b/diff.c
index 35e3c619864..71b340c5368 100644
--- a/diff.c
+++ b/diff.c
@@ -1675,7 +1675,7 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
 	return 0;
 }
 
-void diff_free_filespec_data_large(struct diff_filespec *s)
+void diff_free_filespec_blob(struct diff_filespec *s)
 {
 	if (s->should_free)
 		free(s->data);
@@ -1690,7 +1690,7 @@ void diff_free_filespec_data_large(struct diff_filespec *s)
 
 void diff_free_filespec_data(struct diff_filespec *s)
 {
-	diff_free_filespec_data_large(s);
+	diff_free_filespec_blob(s);
 	free(s->cnt_data);
 	s->cnt_data = NULL;
 }
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 4fc200064ae..142e5376dd7 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -378,10 +378,10 @@ void diffcore_rename(struct diff_options *options)
 			m->score = estimate_similarity(one, two,
 						       minimum_score);
 			m->name_score = basename_same(one, two);
-			diff_free_filespec_data_large(one);
+			diff_free_filespec_blob(one);
 		}
 		/* We do not need the text anymore */
-		diff_free_filespec_data_large(two);
+		diff_free_filespec_blob(two);
 		dst_cnt++;
 	}
 	/* cost matrix sorted by most to least similar pair */
diff --git a/diffcore.h b/diffcore.h
index 4bf175bda99..eb618b1ec00 100644
--- a/diffcore.h
+++ b/diffcore.h
@@ -48,7 +48,7 @@ extern void fill_filespec(struct diff_filespec *, const unsigned char *,
 
 extern int diff_populate_filespec(struct diff_filespec *, int);
 extern void diff_free_filespec_data(struct diff_filespec *);
-extern void diff_free_filespec_data_large(struct diff_filespec *);
+extern void diff_free_filespec_blob(struct diff_filespec *);
 extern int diff_filespec_is_binary(struct diff_filespec *);
 
 struct diff_filepair {

From 96e24abc9f14c83abd1e269e1d5bc1c9e50d3fca Mon Sep 17 00:00:00 2001
From: Robert Schiele <rschiele@gmail.com>
Date: Wed, 3 Oct 2007 03:49:34 +0200
Subject: [PATCH 12/15] the ar tool is called gar on some systems

Some systems that have only installed the GNU toolchain (prefixed with "g")
do not provide "ar" but only "gar".  Make configure find this tool as well.

Signed-off-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 84fd7f1e1f2..ed7cc895d27 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,7 +104,7 @@ AC_MSG_NOTICE([CHECKS for programs])
 #
 AC_PROG_CC([cc gcc])
 #AC_PROG_INSTALL		# needs install-sh or install.sh in sources
-AC_CHECK_TOOL(AR, ar, :)
+AC_CHECK_TOOLS(AR, [gar ar], :)
 AC_CHECK_PROGS(TAR, [gtar tar])
 # TCLTK_PATH will be set to some value if we want Tcl/Tk
 # or will be empty otherwise.

From 95af39fcb2d84c8ef2844a9d890e3c67a2e0e1ec Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp@keithp.com>
Date: Tue, 2 Oct 2007 22:44:15 -0700
Subject: [PATCH 13/15] Must not modify the_index.cache as it may be passed to
 realloc at some point.

The index cache is not static, growing as new entries are added. If
entries are added after prune_cache is called, cache will no longer
point at the base of the allocation, and realloc will not be happy.

I verified that this was the only place in the current source which
modified any index_state.cache elements aside from the alloc/realloc
calls in read-cache by changing the type of the element to 'struct
cache_entry ** const cache' and recompiling.

A more efficient patch would create a separate 'cache_base' value to
track the allocation and then fix things up when reallocation was
necessary, instead of the brute-force memmove used here.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin-ls-files.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index 6c1db86e805..171d449048d 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -280,7 +280,8 @@ static void prune_cache(const char *prefix)
 
 	if (pos < 0)
 		pos = -pos-1;
-	active_cache += pos;
+	memmove(active_cache, active_cache + pos,
+		(active_nr - pos) * sizeof(struct cache_entry *));
 	active_nr -= pos;
 	first = 0;
 	last = active_nr;

From 54e1abce90ed44d0674772a735ac387ce3e264f2 Mon Sep 17 00:00:00 2001
From: Carl Worth <cworth@cworth.org>
Date: Wed, 3 Oct 2007 00:03:53 -0700
Subject: [PATCH 14/15] Add test case for ls-files --with-tree

This tests basic functionality and also exercises a bug noticed
by Keith Packard, (prune_cache followed by add_index_entry can
trigger an attempt to realloc a pointer into the middle of an
allocated buffer).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t3060-ls-files-with-tree.sh | 71 +++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100755 t/t3060-ls-files-with-tree.sh

diff --git a/t/t3060-ls-files-with-tree.sh b/t/t3060-ls-files-with-tree.sh
new file mode 100755
index 00000000000..68eb266d735
--- /dev/null
+++ b/t/t3060-ls-files-with-tree.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Carl D. Worth
+#
+
+test_description='git ls-files test (--with-tree).
+
+This test runs git ls-files --with-tree and in particular in
+a scenario known to trigger a crash with some versions of git.
+'
+. ./test-lib.sh
+
+test_expect_success setup '
+
+	# The bug we are exercising requires a fair number of entries
+	# in a sub-directory so that add_index_entry will trigger a
+	# realloc.
+
+	echo file >expected &&
+	mkdir sub &&
+	bad= &&
+	for n in 0 1 2 3 4 5
+	do
+		for m in 0 1 2 3 4 5 6 7 8 9
+		do
+			num=00$n$m &&
+			>sub/file-$num &&
+			echo file-$num >>expected || {
+				bad=t
+				break
+			}
+		done && test -z "$bad" || {
+			bad=t
+			break
+		}
+	done && test -z "$bad" &&
+	git add . &&
+	git commit -m "add a bunch of files" &&
+
+	# We remove them all so that we will have something to add
+	# back with --with-tree and so that we will definitely be
+	# under the realloc size to trigger the bug.
+	rm -rf sub &&
+	git commit -a -m "remove them all" &&
+
+	# The bug also requires some entry before our directory so that
+	# prune_path will modify the_index.cache
+
+	mkdir a_directory_that_sorts_before_sub &&
+	>a_directory_that_sorts_before_sub/file &&
+	mkdir sub &&
+	>sub/file &&
+	git add .
+'
+
+# We have to run from a sub-directory to trigger prune_path
+# Then we finally get to run our --with-tree test
+cd sub
+
+test_expect_success 'git -ls-files --with-tree should succeed from subdir' '
+
+	git ls-files --with-tree=HEAD~1 >../output
+
+'
+
+cd ..
+test_expect_success \
+    'git -ls-files --with-tree should add entries from named tree.' \
+    'diff -u expected output'
+
+test_done

From 4c75136f7697f76b31641db775163f5c75906ee2 Mon Sep 17 00:00:00 2001
From: Junio C Hamano <gitster@pobox.com>
Date: Wed, 3 Oct 2007 02:33:11 -0700
Subject: [PATCH 15/15] GIT 1.5.3.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/RelNotes-1.5.3.4.txt | 27 +++++++++++++++++----------
 GIT-VERSION-GEN                    |  2 +-
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/Documentation/RelNotes-1.5.3.4.txt b/Documentation/RelNotes-1.5.3.4.txt
index 47ba2870a28..b04b3a45a56 100644
--- a/Documentation/RelNotes-1.5.3.4.txt
+++ b/Documentation/RelNotes-1.5.3.4.txt
@@ -4,25 +4,32 @@ GIT v1.5.3.4 Release Notes
 Fixes since v1.5.3.3
 --------------------
 
- * Sample 'post-receive-hook' incorrectly sent out push
+ * Change to "git-ls-files" in v1.5.3.3 that was introduced to support
+   partial commit of removal better had a segfaulting bug, which was
+   diagnosed and fixed by Keith and Carl.
+
+ * Performance improvements for rename detection has been backported
+   from the 'master' branch.
+
+ * "git-for-each-ref --format='%(numparent)'" was not working
+   correctly at all, and --format='%(parent)' was not working for
+   merge commits.
+
+ * Sample "post-receive-hook" incorrectly sent out push
    notification e-mails marked as "From: " the committer of the
    commit that happened to be at the tip of the branch that was
    pushed, not from the person who pushed.
 
- * git-remote did not exit non-zero status upon error.
+ * "git-remote" did not exit non-zero status upon error.
 
  * "git-add -i" did not respond very well to EOF from tty nor
    bogus input.
 
- * "git rebase -i" squash subcommand incorrectly made the
+ * "git-rebase -i" squash subcommand incorrectly made the
    author of later commit the author of resulting commit,
    instead of taking from the first one in the squashed series.
 
- * "git stash apply --index" was not documented.
+ * "git-stash apply --index" was not documented.
 
-
---
-exec >/var/tmp/1
-O=v1.5.3.3-6-g0bdcac5
-echo O=`git describe refs/heads/maint`
-git shortlog --no-merges $O..refs/heads/maint
+ * autoconfiguration learned that "ar" command is found as "gas" on
+   some systems.
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 6de899a4659..223c4f5e144 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v1.5.3.3.GIT
+DEF_VER=v1.5.3.4.GIT
 
 LF='
 '