[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#637840: pu: package git/1:1.7.2.5-3



Jonathan Nieder wrote:

> debdiff attached, or see

Erm.  (Here it is.  Sorry for the noise.)
diff -u git-1.7.2.5/debian/changelog git-1.7.2.5/debian/changelog
--- git-1.7.2.5/debian/changelog
+++ git-1.7.2.5/debian/changelog
@@ -1,3 +1,24 @@
+git (1:1.7.2.5-3) stable; urgency=low
+
+  * debian/diff/0034..0043: new from the upstream maint-1.7.2 branch:
+    * bisect, blame, cherry-pick, merge-recursive, revert: fix
+      off-by-one read when searching for the end of a commit subject.
+    * fast-import: allow frontends to check for notes import feature.
+    * some minor documentation updates.
+  * debian/diff/0044-upload-pack-start-pack-objects-before-...: new
+    from upstream; upload-pack: start child that reads pack_pipe
+    before writing to it.  This prevents server-side deadlocks on
+    shallow clone (closes: #607346).
+  * debian/git-daemon/run: use SO_REUSEADDR when binding the listening
+    socket so the server can restart without waiting for old connections
+    to time out (thx Daniel Kahn Gillmor; closes: #609405).
+  * debian/git-daemon-run.postrm purge: terminate the git-daemon/log
+    service, even if there is an active connection using it, before
+    deleting logs and the gitlog user (thx Daniel Kahn Gillmor; closes:
+    #627314).
+
+ -- Jonathan Nieder <jrnieder@gmail.com>  Sun, 14 Aug 2011 18:29:50 -0500
+
 git (1:1.7.2.5-2) stable; urgency=low
 
   * debian/git-daemon-run.postrm purge: terminate the git-daemon/log
diff -u git-1.7.2.5/debian/git-daemon-run.postrm git-1.7.2.5/debian/git-daemon-run.postrm
--- git-1.7.2.5/debian/git-daemon-run.postrm
+++ git-1.7.2.5/debian/git-daemon-run.postrm
@@ -3,7 +3,10 @@
 
 test "$1" = 'purge' || exit 0
 
+sv down /etc/sv/git-daemon 2>/dev/null || :
+sv down /etc/sv/git-daemon/log 2>/dev/null || :
 sv force-shutdown /etc/sv/git-daemon 2>/dev/null || :
+sv force-stop /etc/sv/git-daemon/log 2>/dev/null || :
 rm -rf /etc/sv/git-daemon/supervise /etc/sv/git-daemon/log/supervise
 rm -rf /var/lib/supervise/git-daemon /var/lib/supervise/git-daemon.log
 
diff -u git-1.7.2.5/debian/git-daemon/run git-1.7.2.5/debian/git-daemon/run
--- git-1.7.2.5/debian/git-daemon/run
+++ git-1.7.2.5/debian/git-daemon/run
@@ -5 +5,2 @@
-  "$(git --exec-path)"/git-daemon --verbose --base-path=/var/cache /var/cache/git
+  "$(git --exec-path)"/git-daemon --verbose --reuseaddr \
+    --base-path=/var/cache /var/cache/git
only in patch2:
unchanged:
--- git-1.7.2.5.orig/debian/diff/0042-fast-import-clarify-documentation-of-feature-command.diff
+++ git-1.7.2.5/debian/diff/0042-fast-import-clarify-documentation-of-feature-command.diff
@@ -0,0 +1,79 @@
+From 6842190a886e546dd588339d8dcdf1baf2810e33 Mon Sep 17 00:00:00 2001
+From: Jonathan Nieder <jrnieder@gmail.com>
+Date: Sun, 28 Nov 2010 13:43:57 -0600
+Subject: fast-import: clarify documentation of "feature" command
+
+The "feature" command allows streams to specify options for the import
+that must not be ignored.  Logically, they are part of the stream,
+even though technically most supported features are synonyms to
+command-line options.
+
+Make this more obvious by being more explicit about how the analogy
+between most "feature" commands and command-line options works.  Treat
+the feature (import-marks) that does not fit this analogy separately.
+
+Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
+Acked-by: Sverre Rabbelier <srabbelier@gmail.com>
+Signed-off-by: Junio C Hamano <gitster@pobox.com>
+Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
+Signed-off-by: Junio C Hamano <gitster@pobox.com>
+(cherry picked from commit 68595cd442caabbd8b43ff0789d2829454efff1b)
+
+Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
+---
+ Documentation/git-fast-import.txt |   33 +++++++++++++++------------------
+ 1 files changed, 15 insertions(+), 18 deletions(-)
+
+diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
+index 77a0a24..00e086e 100644
+--- a/Documentation/git-fast-import.txt
++++ b/Documentation/git-fast-import.txt
+@@ -878,28 +878,25 @@ Require that fast-import supports the specified feature, or abort if
+ it does not.
+ 
+ ....
+-	'feature' SP <feature> LF
++	'feature' SP <feature> ('=' <argument>)? LF
+ ....
+ 
+-The <feature> part of the command may be any string matching
+-^[a-zA-Z][a-zA-Z-]*$ and should be understood by fast-import.
+-
+-Feature work identical as their option counterparts with the
+-exception of the import-marks feature, see below.
+-
+-The following features are currently supported:
+-
+-* date-format
+-* import-marks
+-* export-marks
+-* relative-marks
+-* no-relative-marks
+-* force
+-
+-The import-marks behaves differently from when it is specified as
+-commandline option in that only one "feature import-marks" is allowed
+-per stream. Also, any --import-marks= specified on the commandline
+-will override those from the stream (if any).
++The <feature> part of the command may be any one of the following:
++
++date-format::
++export-marks::
++relative-marks::
++no-relative-marks::
++force::
++	Act as though the corresponding command-line option with
++	a leading '--' was passed on the command line
++	(see OPTIONS, above).
++
++import-marks::
++	Like --import-marks except in two respects: first, only one
++	"feature import-marks" command is allowed per stream;
++	second, an --import-marks= command-line option overrides
++	any "feature import-marks" command in the stream.
+ 
+ `option`
+ ~~~~~~~~
+-- 
+1.7.6
+
only in patch2:
unchanged:
--- git-1.7.2.5.orig/debian/diff/0038-merge-recursive-use-find_commit_subject-instead-of-cu.diff
+++ git-1.7.2.5/debian/diff/0038-merge-recursive-use-find_commit_subject-instead-of-cu.diff
@@ -0,0 +1,42 @@
+From 21e9989634b5136df96307f9c649cff2dc348d26 Mon Sep 17 00:00:00 2001
+From: Christian Couder <chriscool@tuxfamily.org>
+Date: Thu, 22 Jul 2010 15:18:34 +0200
+Subject: merge-recursive: use find_commit_subject() instead of custom code
+
+Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
+Signed-off-by: Junio C Hamano <gitster@pobox.com>
+(cherry picked from commit 49b7120ef1c915439b01f23f30ddfe64565ec9cc)
+
+Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
+---
+ merge-recursive.c |   14 ++++----------
+ 1 files changed, 4 insertions(+), 10 deletions(-)
+
+diff --git a/merge-recursive.c b/merge-recursive.c
+index fb6aa4a..7635659 100644
+--- a/merge-recursive.c
++++ b/merge-recursive.c
+@@ -136,16 +136,10 @@ static void output_commit_title(struct merge_options *o, struct commit *commit)
+ 		if (parse_commit(commit) != 0)
+ 			printf("(bad commit)\n");
+ 		else {
+-			const char *s;
+-			int len;
+-			for (s = commit->buffer; *s; s++)
+-				if (*s == '\n' && s[1] == '\n') {
+-					s += 2;
+-					break;
+-				}
+-			for (len = 0; s[len] && '\n' != s[len]; len++)
+-				; /* do nothing */
+-			printf("%.*s\n", len, s);
++			const char *title;
++			int len = find_commit_subject(commit->buffer, &title);
++			if (len)
++				printf("%.*s\n", len, title);
+ 		}
+ 	}
+ }
+-- 
+1.7.6
+
only in patch2:
unchanged:
--- git-1.7.2.5.orig/debian/diff/0043-fast-import-introduce-feature-notes-command.diff
+++ git-1.7.2.5/debian/diff/0043-fast-import-introduce-feature-notes-command.diff
@@ -0,0 +1,85 @@
+From 5eb351a734c7ca3dfbc89c0180072995b85d371f Mon Sep 17 00:00:00 2001
+From: Jonathan Nieder <jrnieder@gmail.com>
+Date: Wed, 9 Feb 2011 16:43:57 -0600
+Subject: fast-import: introduce "feature notes" command
+
+Here is a 'feature' command for streams to use to require support for
+the notemodify (N) command.
+
+When the 'feature' facility was introduced (v1.7.0-rc0~95^2~4,
+2009-12-04), the notes import feature was old news (v1.6.6-rc0~21^2~8,
+2009-10-09) and it was not obvious it deserved to be a named feature.
+But now that is clear, since all major non-git fast-import backends
+lack support for it.
+
+Details: on git version with this patch applied, any "feature notes"
+command in the features/options section at the beginning of a stream
+will be treated as a no-op.  On fast-import implementations without
+the feature (and older git versions), the command instead errors out
+with a message like
+
+	This version of fast-import does not support feature notes.
+
+So by declaring use of notes at the beginning of a stream, frontends
+can avoid wasting time and other resources when the backend does not
+support notes.  (This would be especially important for backends that
+do not support rewinding history after a botched import.)
+
+Improved-by: Thomas Rast <trast@student.ethz.ch>
+Improved-by: Sverre Rabbelier <srabbelier@gmail.com>
+Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
+Signed-off-by: Junio C Hamano <gitster@pobox.com>
+(cherry picked from commit 547e8b9205349b47003ed25a82673e413e71c255)
+
+Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
+---
+ Documentation/git-fast-import.txt |    6 ++++++
+ fast-import.c                     |    2 ++
+ t/t9301-fast-import-notes.sh      |    1 +
+ 3 files changed, 9 insertions(+), 0 deletions(-)
+
+diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
+index 00e086e..072d4f9 100644
+--- a/Documentation/git-fast-import.txt
++++ b/Documentation/git-fast-import.txt
+@@ -898,6 +898,12 @@ import-marks::
+ 	second, an --import-marks= command-line option overrides
+ 	any "feature import-marks" command in the stream.
+ 
++notes::
++	Require that the backend support the 'notemodify' (N)
++	subcommand to the 'commit' command.
++	Versions of fast-import not supporting notes will exit
++	with a message indicating so.
++
+ `option`
+ ~~~~~~~~
+ Processes the specified option so that git fast-import behaves in a
+diff --git a/fast-import.c b/fast-import.c
+index ddad289..86687f3 100644
+--- a/fast-import.c
++++ b/fast-import.c
+@@ -2800,6 +2800,8 @@ static int parse_one_feature(const char *feature, int from_stream)
+ 		relative_marks_paths = 0;
+ 	} else if (!prefixcmp(feature, "force")) {
+ 		force_update = 1;
++	} else if (!strcmp(feature, "notes")) {
++		; /* do nothing; we have the feature */
+ 	} else {
+ 		return 0;
+ 	}
+diff --git a/t/t9301-fast-import-notes.sh b/t/t9301-fast-import-notes.sh
+index a5c99d8..164edf0 100755
+--- a/t/t9301-fast-import-notes.sh
++++ b/t/t9301-fast-import-notes.sh
+@@ -120,6 +120,7 @@ test_expect_success 'add notes with simple M command' '
+ 
+ test_tick
+ cat >input <<INPUT_END
++feature notes
+ commit refs/notes/test
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+-- 
+1.7.6
+
only in patch2:
unchanged:
--- git-1.7.2.5.orig/debian/diff/0035-revert-refactor-code-to-find-commit-subject-in-find_c.diff
+++ git-1.7.2.5/debian/diff/0035-revert-refactor-code-to-find-commit-subject-in-find_c.diff
@@ -0,0 +1,95 @@
+From 25976c71edbc16f22f0693e6744b9130d59a29e2 Mon Sep 17 00:00:00 2001
+From: Christian Couder <chriscool@tuxfamily.org>
+Date: Thu, 22 Jul 2010 15:18:30 +0200
+Subject: revert: refactor code to find commit subject in find_commit_subject()
+
+Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
+Signed-off-by: Junio C Hamano <gitster@pobox.com>
+(cherry picked from commit 11af2aaed657d10dea083f5d5cb7f93bb96a7b70)
+
+Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
+---
+ builtin/revert.c |   14 ++------------
+ commit.c         |   19 +++++++++++++++++++
+ commit.h         |    3 +++
+ 3 files changed, 24 insertions(+), 12 deletions(-)
+
+diff --git a/builtin/revert.c b/builtin/revert.c
+index 87fad24..7295038 100644
+--- a/builtin/revert.c
++++ b/builtin/revert.c
+@@ -102,7 +102,7 @@ struct commit_message {
+ static int get_message(const char *raw_message, struct commit_message *out)
+ {
+ 	const char *encoding;
+-	const char *p, *abbrev, *eol;
++	const char *p, *abbrev;
+ 	char *q;
+ 	int abbrev_len, oneline_len;
+ 
+@@ -125,17 +125,7 @@ static int get_message(const char *raw_message, struct commit_message *out)
+ 	abbrev = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);
+ 	abbrev_len = strlen(abbrev);
+ 
+-	/* Find beginning and end of commit subject. */
+-	p = out->message;
+-	while (*p && (*p != '\n' || p[1] != '\n'))
+-		p++;
+-	if (*p) {
+-		p += 2;
+-		for (eol = p; *eol && *eol != '\n'; eol++)
+-			; /* do nothing */
+-	} else
+-		eol = p;
+-	oneline_len = eol - p;
++	oneline_len = find_commit_subject(out->message, &p);
+ 
+ 	out->parent_label = xmalloc(strlen("parent of ") + abbrev_len +
+ 			      strlen("... ") + oneline_len + 1);
+diff --git a/commit.c b/commit.c
+index e9b0750..0094ec1 100644
+--- a/commit.c
++++ b/commit.c
+@@ -315,6 +315,25 @@ int parse_commit(struct commit *item)
+ 	return ret;
+ }
+ 
++int find_commit_subject(const char *commit_buffer, const char **subject)
++{
++	const char *eol;
++	const char *p = commit_buffer;
++
++	while (*p && (*p != '\n' || p[1] != '\n'))
++		p++;
++	if (*p) {
++		p += 2;
++		for (eol = p; *eol && *eol != '\n'; eol++)
++			; /* do nothing */
++	} else
++		eol = p;
++
++	*subject = p;
++
++	return eol - p;
++}
++
+ struct commit_list *commit_list_insert(struct commit *item, struct commit_list **list_p)
+ {
+ 	struct commit_list *new_list = xmalloc(sizeof(struct commit_list));
+diff --git a/commit.h b/commit.h
+index eb2b8ac..9113bbe 100644
+--- a/commit.h
++++ b/commit.h
+@@ -41,6 +41,9 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size);
+ 
+ int parse_commit(struct commit *item);
+ 
++/* Find beginning and length of commit subject. */
++int find_commit_subject(const char *commit_buffer, const char **subject);
++
+ struct commit_list * commit_list_insert(struct commit *item, struct commit_list **list_p);
+ unsigned commit_list_count(const struct commit_list *l);
+ struct commit_list * insert_by_date(struct commit *item, struct commit_list **list);
+-- 
+1.7.6
+
only in patch2:
unchanged:
--- git-1.7.2.5.orig/debian/diff/0044-upload-pack-start-pack-objects-before-async-rev-list.diff
+++ git-1.7.2.5/debian/diff/0044-upload-pack-start-pack-objects-before-async-rev-list.diff
@@ -0,0 +1,99 @@
+From b6405129c6ca68f56b654a1ef6cc82984949c4a8 Mon Sep 17 00:00:00 2001
+From: Jeff King <peff@github.com>
+Date: Wed, 6 Apr 2011 17:33:33 -0400
+Subject: upload-pack: start pack-objects before async rev-list
+
+In a pthread-enabled version of upload-pack, there's a race condition
+that can cause a deadlock on the fflush(NULL) we call from run-command.
+
+What happens is this:
+
+  1. Upload-pack is informed we are doing a shallow clone.
+
+  2. We call start_async() to spawn a thread that will generate rev-list
+     results to feed to pack-objects. It gets a file descriptor to a
+     pipe which will eventually hook to pack-objects.
+
+  3. The rev-list thread uses fdopen to create a new output stream
+     around the fd we gave it, called pack_pipe.
+
+  4. The thread writes results to pack_pipe. Outside of our control,
+     libc is doing locking on the stream. We keep writing until the OS
+     pipe buffer is full, and then we block in write(), still holding
+     the lock.
+
+  5. The main thread now uses start_command to spawn pack-objects.
+     Before forking, it calls fflush(NULL) to flush every stdio output
+     buffer. It blocks trying to get the lock on pack_pipe.
+
+And we have a deadlock. The thread will block until somebody starts
+reading from the pipe. But nobody will read from the pipe until we
+finish flushing to the pipe.
+
+To fix this, we swap the start order: we start the
+pack-objects reader first, and then the rev-list writer
+after. Thus the problematic fflush(NULL) happens before we
+even open the new file descriptor (and even if it didn't,
+flushing should no longer block, as the reader at the end of
+the pipe is now active).
+
+Signed-off-by: Jeff King <peff@peff.net>
+Signed-off-by: Junio C Hamano <gitster@pobox.com>
+(cherry picked from commit b9612197798dbfc622c766e83b1fe4c20bffae5c)
+
+Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
+---
+ upload-pack.c |   23 +++++++++++------------
+ 1 files changed, 11 insertions(+), 12 deletions(-)
+
+diff --git a/upload-pack.c b/upload-pack.c
+index dc464d7..3f416e8 100644
+--- a/upload-pack.c
++++ b/upload-pack.c
+@@ -161,15 +161,8 @@ static void create_pack_file(void)
+ 	const char *argv[10];
+ 	int arg = 0;
+ 
+-	if (shallow_nr) {
+-		memset(&rev_list, 0, sizeof(rev_list));
+-		rev_list.proc = do_rev_list;
+-		rev_list.out = -1;
+-		if (start_async(&rev_list))
+-			die("git upload-pack: unable to fork git-rev-list");
+-		argv[arg++] = "pack-objects";
+-	} else {
+-		argv[arg++] = "pack-objects";
++	argv[arg++] = "pack-objects";
++	if (!shallow_nr) {
+ 		argv[arg++] = "--revs";
+ 		if (create_full_pack)
+ 			argv[arg++] = "--all";
+@@ -187,7 +180,7 @@ static void create_pack_file(void)
+ 	argv[arg++] = NULL;
+ 
+ 	memset(&pack_objects, 0, sizeof(pack_objects));
+-	pack_objects.in = shallow_nr ? rev_list.out : -1;
++	pack_objects.in = -1;
+ 	pack_objects.out = -1;
+ 	pack_objects.err = -1;
+ 	pack_objects.git_cmd = 1;
+@@ -196,8 +189,14 @@ static void create_pack_file(void)
+ 	if (start_command(&pack_objects))
+ 		die("git upload-pack: unable to fork git-pack-objects");
+ 
+-	/* pass on revisions we (don't) want */
+-	if (!shallow_nr) {
++	if (shallow_nr) {
++		memset(&rev_list, 0, sizeof(rev_list));
++		rev_list.proc = do_rev_list;
++		rev_list.out = pack_objects.in;
++		if (start_async(&rev_list))
++			die("git upload-pack: unable to fork git-rev-list");
++	}
++	else {
+ 		FILE *pipe_fd = xfdopen(pack_objects.in, "w");
+ 		if (!create_full_pack) {
+ 			int i;
+-- 
+1.7.6
+
only in patch2:
unchanged:
--- git-1.7.2.5.orig/debian/diff/0041-Documentation-githooks-post-rewrite-copy-notes-never-.diff
+++ git-1.7.2.5/debian/diff/0041-Documentation-githooks-post-rewrite-copy-notes-never-.diff
@@ -0,0 +1,42 @@
+From 58d81d043304ec5f3607b3ccb9031178938673c0 Mon Sep 17 00:00:00 2001
+From: Thomas Rast <trast@student.ethz.ch>
+Date: Mon, 10 Jan 2011 13:42:23 +0100
+Subject: Documentation/githooks: post-rewrite-copy-notes never existed
+
+The documentation for the post-rewrite hook contains a paragraph from
+its early development, where the automatic notes copying facilities
+were not part of the series and thus this had to be a hook.  Later
+versions of the series implemented notes copying as a core feature.
+
+Thus mentioning post-rewrite-copy-notes was never correct.  As the
+other hooks do not have a "there is no default hook, but..." sentence
+unless they ship a sample hook in either templates or contrib, we
+simply remove the whole paragraph.
+
+Signed-off-by: Thomas Rast <trast@student.ethz.ch>
+Signed-off-by: Junio C Hamano <gitster@pobox.com>
+(cherry picked from commit 920a5d436b0309072de598a44b493ba0793b074c)
+
+Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
+---
+ Documentation/githooks.txt |    4 ----
+ 1 files changed, 0 insertions(+), 4 deletions(-)
+
+diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
+index 7183aa9..28edefa 100644
+--- a/Documentation/githooks.txt
++++ b/Documentation/githooks.txt
+@@ -350,10 +350,6 @@ rebase::
+ The commits are guaranteed to be listed in the order that they were
+ processed by rebase.
+ 
+-There is no default 'post-rewrite' hook, but see the
+-`post-receive-copy-notes` script in `contrib/hooks` for an example
+-that copies your git-notes to the rewritten commits.
+-
+ 
+ GIT
+ ---
+-- 
+1.7.6
+
only in patch2:
unchanged:
--- git-1.7.2.5.orig/debian/diff/0037-bisect-use-find_commit_subject-instead-of-custom-code.diff
+++ git-1.7.2.5/debian/diff/0037-bisect-use-find_commit_subject-instead-of-custom-code.diff
@@ -0,0 +1,48 @@
+From 1340307cc8892b1bb176383444811c9ad43a2ff8 Mon Sep 17 00:00:00 2001
+From: Christian Couder <chriscool@tuxfamily.org>
+Date: Thu, 22 Jul 2010 15:18:33 +0200
+Subject: bisect: use find_commit_subject() instead of custom code
+
+Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
+Signed-off-by: Junio C Hamano <gitster@pobox.com>
+(cherry picked from commit 56ff37941eb76d3f0097884715ca8b391788a3c9)
+
+Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
+---
+ bisect.c |   13 +++++--------
+ 1 files changed, 5 insertions(+), 8 deletions(-)
+
+diff --git a/bisect.c b/bisect.c
+index b556b11..060c042 100644
+--- a/bisect.c
++++ b/bisect.c
+@@ -141,7 +141,8 @@ static void show_list(const char *debug, int counted, int nr,
+ 		enum object_type type;
+ 		unsigned long size;
+ 		char *buf = read_sha1_file(commit->object.sha1, &type, &size);
+-		char *ep, *sp;
++		const char *subject_start;
++		int subject_len;
+ 
+ 		fprintf(stderr, "%c%c%c ",
+ 			(flags & TREESAME) ? ' ' : 'T',
+@@ -156,13 +157,9 @@ static void show_list(const char *debug, int counted, int nr,
+ 			fprintf(stderr, " %.*s", 8,
+ 				sha1_to_hex(pp->item->object.sha1));
+ 
+-		sp = strstr(buf, "\n\n");
+-		if (sp) {
+-			sp += 2;
+-			for (ep = sp; *ep && *ep != '\n'; ep++)
+-				;
+-			fprintf(stderr, " %.*s", (int)(ep - sp), sp);
+-		}
++		subject_len = find_commit_subject(buf, &subject_start);
++		if (subject_len)
++			fprintf(stderr, " %.*s", subject_len, subject_start);
+ 		fprintf(stderr, "\n");
+ 	}
+ }
+-- 
+1.7.6
+
only in patch2:
unchanged:
--- git-1.7.2.5.orig/debian/diff/0034-revert-fix-off-by-one-read-when-searching-the-end-of-.diff
+++ git-1.7.2.5/debian/diff/0034-revert-fix-off-by-one-read-when-searching-the-end-of-.diff
@@ -0,0 +1,71 @@
+From 040868aac52795b93648acf3a5587799fc155ad6 Mon Sep 17 00:00:00 2001
+From: Christian Couder <chriscool@tuxfamily.org>
+Date: Thu, 22 Jul 2010 15:18:29 +0200
+Subject: revert: fix off by one read when searching the end of a commit subject
+
+A test case is added but the problem can only be seen when running
+the test case with --valgrind.
+
+Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
+Acked-by: Jonathan Nieder <jrnieder@gmail.com>
+Signed-off-by: Junio C Hamano <gitster@pobox.com>
+(cherry picked from commit 2c048a3038fd4d94e150fbc1dfd2242325ca7db6)
+
+Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
+---
+ builtin/revert.c             |    2 +-
+ t/t3505-cherry-pick-empty.sh |   20 +++++++++++++++++++-
+ 2 files changed, 20 insertions(+), 2 deletions(-)
+
+diff --git a/builtin/revert.c b/builtin/revert.c
+index 54d13cf..87fad24 100644
+--- a/builtin/revert.c
++++ b/builtin/revert.c
+@@ -131,7 +131,7 @@ static int get_message(const char *raw_message, struct commit_message *out)
+ 		p++;
+ 	if (*p) {
+ 		p += 2;
+-		for (eol = p + 1; *eol && *eol != '\n'; eol++)
++		for (eol = p; *eol && *eol != '\n'; eol++)
+ 			; /* do nothing */
+ 	} else
+ 		eol = p;
+diff --git a/t/t3505-cherry-pick-empty.sh b/t/t3505-cherry-pick-empty.sh
+index e51e505..c10b28c 100755
+--- a/t/t3505-cherry-pick-empty.sh
++++ b/t/t3505-cherry-pick-empty.sh
+@@ -13,12 +13,30 @@ test_expect_success setup '
+ 
+ 	git checkout -b empty-branch &&
+ 	test_tick &&
+-	git commit --allow-empty -m "empty"
++	git commit --allow-empty -m "empty" &&
++
++	echo third >> file1 &&
++	git add file1 &&
++	test_tick &&
++	git commit --allow-empty-message -m ""
+ 
+ '
+ 
+ test_expect_success 'cherry-pick an empty commit' '
+ 	git checkout master && {
++		git cherry-pick empty-branch^
++		test "$?" = 1
++	}
++'
++
++test_expect_success 'index lockfile was removed' '
++
++	test ! -f .git/index.lock
++
++'
++
++test_expect_success 'cherry-pick a commit with an empty message' '
++	git checkout master && {
+ 		git cherry-pick empty-branch
+ 		test "$?" = 1
+ 	}
+-- 
+1.7.6
+
only in patch2:
unchanged:
--- git-1.7.2.5.orig/debian/diff/0036-revert-rename-variables-related-to-subject-in-get_mes.diff
+++ git-1.7.2.5/debian/diff/0036-revert-rename-variables-related-to-subject-in-get_mes.diff
@@ -0,0 +1,57 @@
+From c863a34a631fd0e24be900901cd9fc8b5227df12 Mon Sep 17 00:00:00 2001
+From: Christian Couder <chriscool@tuxfamily.org>
+Date: Thu, 22 Jul 2010 15:18:31 +0200
+Subject: revert: rename variables related to subject in get_message()
+
+Generic-looking pointer variable "p" was used only to point at subject
+string and had a rather lifespan.
+
+Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
+Signed-off-by: Junio C Hamano <gitster@pobox.com>
+(cherry picked from commit dfe7effe7d873015c8624d438b98671083c12e27)
+
+Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
+---
+ builtin/revert.c |   10 +++++-----
+ 1 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/builtin/revert.c b/builtin/revert.c
+index 7295038..070dcc7 100644
+--- a/builtin/revert.c
++++ b/builtin/revert.c
+@@ -102,9 +102,9 @@ struct commit_message {
+ static int get_message(const char *raw_message, struct commit_message *out)
+ {
+ 	const char *encoding;
+-	const char *p, *abbrev;
++	const char *abbrev, *subject;
++	int abbrev_len, subject_len;
+ 	char *q;
+-	int abbrev_len, oneline_len;
+ 
+ 	if (!raw_message)
+ 		return -1;
+@@ -125,17 +125,17 @@ static int get_message(const char *raw_message, struct commit_message *out)
+ 	abbrev = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);
+ 	abbrev_len = strlen(abbrev);
+ 
+-	oneline_len = find_commit_subject(out->message, &p);
++	subject_len = find_commit_subject(out->message, &subject);
+ 
+ 	out->parent_label = xmalloc(strlen("parent of ") + abbrev_len +
+-			      strlen("... ") + oneline_len + 1);
++			      strlen("... ") + subject_len + 1);
+ 	q = out->parent_label;
+ 	q = mempcpy(q, "parent of ", strlen("parent of "));
+ 	out->label = q;
+ 	q = mempcpy(q, abbrev, abbrev_len);
+ 	q = mempcpy(q, "... ", strlen("... "));
+ 	out->subject = q;
+-	q = mempcpy(q, p, oneline_len);
++	q = mempcpy(q, subject, subject_len);
+ 	*q = '\0';
+ 	return 0;
+ }
+-- 
+1.7.6
+
only in patch2:
unchanged:
--- git-1.7.2.5.orig/debian/diff/0039-blame-use-find_commit_subject-instead-of-custom-code.diff
+++ git-1.7.2.5/debian/diff/0039-blame-use-find_commit_subject-instead-of-custom-code.diff
@@ -0,0 +1,59 @@
+From b1e96e5ab4ecfba9995e9c94ea6584cbf10c4433 Mon Sep 17 00:00:00 2001
+From: Christian Couder <chriscool@tuxfamily.org>
+Date: Thu, 22 Jul 2010 15:18:35 +0200
+Subject: blame: use find_commit_subject() instead of custom code
+
+Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
+Signed-off-by: Junio C Hamano <gitster@pobox.com>
+(cherry picked from commit ad98a58b3d7a151dca59364b72097b6b875a56f6)
+
+Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
+---
+ builtin/blame.c |   22 +++++++---------------
+ 1 files changed, 7 insertions(+), 15 deletions(-)
+
+diff --git a/builtin/blame.c b/builtin/blame.c
+index 28e3be2..1015354 100644
+--- a/builtin/blame.c
++++ b/builtin/blame.c
+@@ -1407,7 +1407,8 @@ static void get_commit_info(struct commit *commit,
+ 			    int detailed)
+ {
+ 	int len;
+-	char *tmp, *endp, *reencoded, *message;
++	const char *subject;
++	char *reencoded, *message;
+ 	static char author_name[1024];
+ 	static char author_mail[1024];
+ 	static char committer_name[1024];
+@@ -1449,22 +1450,13 @@ static void get_commit_info(struct commit *commit,
+ 		    &ret->committer_time, &ret->committer_tz);
+ 
+ 	ret->summary = summary_buf;
+-	tmp = strstr(message, "\n\n");
+-	if (!tmp) {
+-	error_out:
++	len = find_commit_subject(message, &subject);
++	if (len && len < sizeof(summary_buf)) {
++		memcpy(summary_buf, subject, len);
++		summary_buf[len] = 0;
++	} else {
+ 		sprintf(summary_buf, "(%s)", sha1_to_hex(commit->object.sha1));
+-		free(reencoded);
+-		return;
+ 	}
+-	tmp += 2;
+-	endp = strchr(tmp, '\n');
+-	if (!endp)
+-		endp = tmp + strlen(tmp);
+-	len = endp - tmp;
+-	if (len >= sizeof(summary_buf) || len == 0)
+-		goto error_out;
+-	memcpy(summary_buf, tmp, len);
+-	summary_buf[len] = 0;
+ 	free(reencoded);
+ }
+ 
+-- 
+1.7.6
+
only in patch2:
unchanged:
--- git-1.7.2.5.orig/debian/diff/0040-Documentation-git-archive-spell-worktree-attributes-c.diff
+++ git-1.7.2.5/debian/diff/0040-Documentation-git-archive-spell-worktree-attributes-c.diff
@@ -0,0 +1,38 @@
+From 6daf46496c7eeda42fbbb3d9f6b2f0697efda640 Mon Sep 17 00:00:00 2001
+From: Thomas Rast <trast@student.ethz.ch>
+Date: Mon, 10 Jan 2011 13:57:43 +0100
+Subject: Documentation/git-archive: spell --worktree-attributes correctly
+
+The --worktree-attributes option was correctly documented in ba053ea
+(archive: do not read .gitattributes in working directory,
+2009-04-18).  However, later in 9b4c8b0 (archive documentation:
+attributes are taken from the tree by default, 2010-02-10) the
+misspelling "--work-tree-attributes" was used to refer to it.  Fix
+this.
+
+Noticed-by: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com>
+Signed-off-by: Thomas Rast <trast@student.ethz.ch>
+Signed-off-by: Junio C Hamano <gitster@pobox.com>
+(cherry picked from commit fc7642a096b99295a636ebde03e4b951a7da9c5a)
+
+Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
+---
+ Documentation/git-archive.txt |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt
+index 8d3e666..bc0eaef 100644
+--- a/Documentation/git-archive.txt
++++ b/Documentation/git-archive.txt
+@@ -116,7 +116,7 @@ Note that attributes are by default taken from the `.gitattributes` files
+ in the tree that is being archived.  If you want to tweak the way the
+ output is generated after the fact (e.g. you committed without adding an
+ appropriate export-ignore in its `.gitattributes`), adjust the checked out
+-`.gitattributes` file as necessary and use `--work-tree-attributes`
++`.gitattributes` file as necessary and use `--worktree-attributes`
+ option.  Alternatively you can keep necessary attributes that should apply
+ while archiving any tree in your `$GIT_DIR/info/attributes` file.
+ 
+-- 
+1.7.6
+

Reply to: