Re: [PATCH 03/18] revert: Simplify and inline add_message_to_msg

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

 



Ramkumar Ramachandra wrote:

> [Subject: [PATCH 03/18] revert: Simplify and inline add_message_to_msg]

Before, I wrote that it would be better to present this as a bugfix
than as a code reorganization, since the former is more likely to
affect people upgrading or to be relevant if this later turns out to
have a regression and someone wonders why not to just revert it.  Was
I wrong?

Testcase below.  It makes a commit like this:

	tree f0db5ba931b3f121d2050e23ac3cd47ac2233306
	parent 43991719f0536a734e91e94f40361114477b3b5e
	author A U Thor <author@xxxxxxxxxxx> 1112912113 -0700
	committer C O Mitter <committer@xxxxxxxxxxx> 1112912113 -0700

with no blank line afterwards.  I think this is relevant and not a
"what if cosmic rays corrupt that pointer" kind of thing because
people use non-git programs or libraries to write to git object stores
pretty often.  If this object were invalid, it would still not be a
good behavior to segfault (better to die() or give some
arbitrary-but-sane result).  Not sure whether the object should be
considered invalid (e.g., "git fsck" accepts it).

Unfortunately it fails for me even after the patch.  If the test looks
reasonable to you, it could be worth adding marked with
"test_expect_failure".

 t/t3501-revert-cherry-pick.sh |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index 595d2ff9..e46e7131 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -12,6 +12,12 @@ test_description='test cherry-pick and revert with renames
 
 . ./test-lib.sh
 
+remove_object() {
+	file=$(echo "$*" | sed 's#..#.git/objects/&#') &&
+	test -e "$file" &&
+	rm -f "$file"
+}
+
 test_expect_success setup '
 
 	for l in a b c d e f g h i j k l m n o
@@ -70,6 +76,25 @@ test_expect_success 'cherry-pick after renaming branch' '
 
 '
 
+test_expect_success 'cherry-pick commit with no delimiter after header' '
+
+	printf "%s\n" rename1 initial >expect &&
+
+	git cat-file commit rename1 >cmit &&
+	sed -e "/^\$/ Q" <cmit >newcmit &&
+	objname=$(git hash-object -t commit -w newcmit) &&
+	test_when_finished "remove_object $objname" &&
+
+	git checkout initial &&
+	git cherry-pick "$objname" &&
+
+	test_path_is_missing oops &&
+	test_path_is_file spoo &&
+	git log --format=%s >actual &&
+	test_cmp expect actual
+
+'
+
 test_expect_success 'revert after renaming branch' '
 
 	git checkout rename1 &&
-- 
1.7.6

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]