From 3a30aa17879b08f96262abb9a22c7bbe8f56e4c9 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Tue, 15 Dec 2015 01:52:04 +0000 Subject: format-patch: add an option to suppress commit hash Oftentimes, patches created by git format-patch will be stored in version control or compared with diff. In these cases, two otherwise identical patches can have different commit hashes, leading to diff noise. Teach git format-patch a --zero-commit option that instead produces an all-zero hash to avoid this diff noise. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- t/t4014-format-patch.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't/t4014-format-patch.sh') diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index 890db1174f..2737ca6346 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -1431,4 +1431,11 @@ test_expect_success 'cover letter auto user override' ' test_line_count = 2 list ' +test_expect_success 'format-patch --zero-commit' ' + git format-patch --zero-commit --stdout v2..v1 >patch2 && + grep "^From " patch2 | sort | uniq >actual && + echo "From $_z40 Mon Sep 17 00:00:00 2001" >expect && + test_cmp expect actual +' + test_done -- cgit v1.2.3 From 06dfc9ebaa154d5074b7afadc2f792a80fba7d0c Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Tue, 15 Dec 2015 01:52:05 +0000 Subject: format-patch: check that header line has expected format The format of the "From " header line is very specific to allow utilities to detect Git-style patches. Add a test that the patches created are in the expected format. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- t/t4014-format-patch.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't/t4014-format-patch.sh') diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index 2737ca6346..646c4750ec 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -1438,4 +1438,11 @@ test_expect_success 'format-patch --zero-commit' ' test_cmp expect actual ' +test_expect_success 'From line has expected format' ' + git format-patch --stdout v2..v1 >patch2 && + grep "^From " patch2 >from && + grep "^From $_x40 Mon Sep 17 00:00:00 2001$" patch2 >filtered && + test_cmp from filtered +' + test_done -- cgit v1.2.3