Git fork

t4*: adjust the references to the default branch name "main"

Carefully excluding t4013 and t4015, which see independent development
elsewhere at the time of writing, we use `main` as the default branch
name in t4*. This trick was performed via

$ (cd t &&
sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
-e 's/Master/Main/g' -- t4*.sh t4211/*.export &&
git checkout HEAD -- t4013\*)

This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main`
for those tests.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Johannes Schindelin and committed by
Junio C Hamano
8f37854b cbc75a12

+319 -319
+89 -89
t/t4014-format-patch.sh
··· 5 6 test_description='various format-patch tests' 7 8 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 35 test_tick && 36 git commit -m "Side changes #3 with \\n backslash-n in it." && 37 38 - git checkout master && 39 git diff-tree -p C2 >patch && 40 git apply --index <patch && 41 test_tick && 42 - git commit -m "Master accepts moral equivalent of #2" && 43 44 git checkout side && 45 git checkout -b patchid && ··· 59 test_tick && 60 git commit -m "patchid 3" && 61 62 - git checkout master 63 ' 64 65 test_expect_success 'format-patch --ignore-if-in-upstream' ' 66 - git format-patch --stdout master..side >patch0 && 67 grep "^From " patch0 >from0 && 68 test_line_count = 3 from0 69 ' 70 71 test_expect_success 'format-patch --ignore-if-in-upstream' ' 72 git format-patch --stdout \ 73 - --ignore-if-in-upstream master..side >patch1 && 74 grep "^From " patch1 >from1 && 75 test_line_count = 2 from1 76 ' 77 78 test_expect_success 'format-patch --ignore-if-in-upstream handles tags' ' 79 git tag -a v1 -m tag side && 80 - git tag -a v2 -m tag master && 81 git format-patch --stdout --ignore-if-in-upstream v2..v1 >patch1 && 82 grep "^From " patch1 >from1 && 83 test_line_count = 2 from1 84 ' 85 86 test_expect_success "format-patch doesn't consider merge commits" ' 87 - git checkout -b feature master && 88 echo "Another line" >>file && 89 test_tick && 90 git commit -am "Feature branch change #1" && 91 echo "Yet another line" >>file && 92 test_tick && 93 git commit -am "Feature branch change #2" && 94 - git checkout -b merger master && 95 test_tick && 96 git merge --no-ff feature && 97 git format-patch -3 --stdout >patch && ··· 100 ' 101 102 test_expect_success 'format-patch result applies' ' 103 - git checkout -b rebuild-0 master && 104 git am -3 patch0 && 105 - git rev-list master.. >list && 106 test_line_count = 2 list 107 ' 108 109 test_expect_success 'format-patch --ignore-if-in-upstream result applies' ' 110 - git checkout -b rebuild-1 master && 111 git am -3 patch1 && 112 - git rev-list master.. >list && 113 test_line_count = 2 list 114 ' 115 ··· 133 " && 134 git config --add format.headers "Cc: S E Cipient <scipient@example.com> 135 " && 136 - git format-patch --stdout master..side >patch2 && 137 sed -e "/^\$/q" patch2 >hdrs2 && 138 grep "^To: R E Cipient <rcipient@example.com>\$" hdrs2 && 139 grep "^Cc: S E Cipient <scipient@example.com>\$" hdrs2 ··· 142 test_expect_success 'extra headers without newlines' ' 143 git config --replace-all format.headers "To: R E Cipient <rcipient@example.com>" && 144 git config --add format.headers "Cc: S E Cipient <scipient@example.com>" && 145 - git format-patch --stdout master..side >patch3 && 146 sed -e "/^\$/q" patch3 >hdrs3 && 147 grep "^To: R E Cipient <rcipient@example.com>\$" hdrs3 && 148 grep "^Cc: S E Cipient <scipient@example.com>\$" hdrs3 ··· 151 test_expect_success 'extra headers with multiple To:s' ' 152 git config --replace-all format.headers "To: R E Cipient <rcipient@example.com>" && 153 git config --add format.headers "To: S E Cipient <scipient@example.com>" && 154 - git format-patch --stdout master..side >patch4 && 155 sed -e "/^\$/q" patch4 >hdrs4 && 156 grep "^To: R E Cipient <rcipient@example.com>,\$" hdrs4 && 157 grep "^ *S E Cipient <scipient@example.com>\$" hdrs4 ··· 159 160 test_expect_success 'additional command line cc (ascii)' ' 161 git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" && 162 - git format-patch --cc="S E Cipient <scipient@example.com>" --stdout master..side >patch5 && 163 sed -e "/^\$/q" patch5 >hdrs5 && 164 grep "^Cc: R E Cipient <rcipient@example.com>,\$" hdrs5 && 165 grep "^ *S E Cipient <scipient@example.com>\$" hdrs5 ··· 167 168 test_expect_failure 'additional command line cc (rfc822)' ' 169 git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" && 170 - git format-patch --cc="S. E. Cipient <scipient@example.com>" --stdout master..side >patch5 && 171 sed -e "/^\$/q" patch5 >hdrs5 && 172 grep "^Cc: R E Cipient <rcipient@example.com>,\$" hdrs5 && 173 grep "^ *\"S. E. Cipient\" <scipient@example.com>\$" hdrs5 ··· 175 176 test_expect_success 'command line headers' ' 177 git config --unset-all format.headers && 178 - git format-patch --add-header="Cc: R E Cipient <rcipient@example.com>" --stdout master..side >patch6 && 179 sed -e "/^\$/q" patch6 >hdrs6 && 180 grep "^Cc: R E Cipient <rcipient@example.com>\$" hdrs6 181 ' 182 183 test_expect_success 'configuration headers and command line headers' ' 184 git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" && 185 - git format-patch --add-header="Cc: S E Cipient <scipient@example.com>" --stdout master..side >patch7 && 186 sed -e "/^\$/q" patch7 >hdrs7 && 187 grep "^Cc: R E Cipient <rcipient@example.com>,\$" hdrs7 && 188 grep "^ *S E Cipient <scipient@example.com>\$" hdrs7 ··· 190 191 test_expect_success 'command line To: header (ascii)' ' 192 git config --unset-all format.headers && 193 - git format-patch --to="R E Cipient <rcipient@example.com>" --stdout master..side >patch8 && 194 sed -e "/^\$/q" patch8 >hdrs8 && 195 grep "^To: R E Cipient <rcipient@example.com>\$" hdrs8 196 ' 197 198 test_expect_failure 'command line To: header (rfc822)' ' 199 - git format-patch --to="R. E. Cipient <rcipient@example.com>" --stdout master..side >patch8 && 200 sed -e "/^\$/q" patch8 >hdrs8 && 201 grep "^To: \"R. E. Cipient\" <rcipient@example.com>\$" hdrs8 202 ' 203 204 test_expect_failure 'command line To: header (rfc2047)' ' 205 - git format-patch --to="R Ä Cipient <rcipient@example.com>" --stdout master..side >patch8 && 206 sed -e "/^\$/q" patch8 >hdrs8 && 207 grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" hdrs8 208 ' 209 210 test_expect_success 'configuration To: header (ascii)' ' 211 git config format.to "R E Cipient <rcipient@example.com>" && 212 - git format-patch --stdout master..side >patch9 && 213 sed -e "/^\$/q" patch9 >hdrs9 && 214 grep "^To: R E Cipient <rcipient@example.com>\$" hdrs9 215 ' 216 217 test_expect_failure 'configuration To: header (rfc822)' ' 218 git config format.to "R. E. Cipient <rcipient@example.com>" && 219 - git format-patch --stdout master..side >patch9 && 220 sed -e "/^\$/q" patch9 >hdrs9 && 221 grep "^To: \"R. E. Cipient\" <rcipient@example.com>\$" hdrs9 222 ' 223 224 test_expect_failure 'configuration To: header (rfc2047)' ' 225 git config format.to "R Ä Cipient <rcipient@example.com>" && 226 - git format-patch --stdout master..side >patch9 && 227 sed -e "/^\$/q" patch9 >hdrs9 && 228 grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" hdrs9 229 ' ··· 237 } 238 239 test_expect_success 'format.from=false' ' 240 - git -c format.from=false format-patch --stdout master..side >patch && 241 sed -e "/^\$/q" patch >hdrs && 242 check_patch patch && 243 ! grep "^From: C O Mitter <committer@example.com>\$" hdrs 244 ' 245 246 test_expect_success 'format.from=true' ' 247 - git -c format.from=true format-patch --stdout master..side >patch && 248 sed -e "/^\$/q" patch >hdrs && 249 check_patch hdrs && 250 grep "^From: C O Mitter <committer@example.com>\$" hdrs 251 ' 252 253 test_expect_success 'format.from with address' ' 254 - git -c format.from="F R Om <from@example.com>" format-patch --stdout master..side >patch && 255 sed -e "/^\$/q" patch >hdrs && 256 check_patch hdrs && 257 grep "^From: F R Om <from@example.com>\$" hdrs 258 ' 259 260 test_expect_success '--no-from overrides format.from' ' 261 - git -c format.from="F R Om <from@example.com>" format-patch --no-from --stdout master..side >patch && 262 sed -e "/^\$/q" patch >hdrs && 263 check_patch hdrs && 264 ! grep "^From: F R Om <from@example.com>\$" hdrs 265 ' 266 267 test_expect_success '--from overrides format.from' ' 268 - git -c format.from="F R Om <from@example.com>" format-patch --from --stdout master..side >patch && 269 sed -e "/^\$/q" patch >hdrs && 270 check_patch hdrs && 271 ! grep "^From: F R Om <from@example.com>\$" hdrs ··· 274 test_expect_success '--no-to overrides config.to' ' 275 git config --replace-all format.to \ 276 "R E Cipient <rcipient@example.com>" && 277 - git format-patch --no-to --stdout master..side >patch10 && 278 sed -e "/^\$/q" patch10 >hdrs10 && 279 check_patch hdrs10 && 280 ! grep "^To: R E Cipient <rcipient@example.com>\$" hdrs10 ··· 284 git config --replace-all format.to \ 285 "Someone <someone@out.there>" && 286 git format-patch --no-to --to="Someone Else <else@out.there>" \ 287 - --stdout master..side >patch11 && 288 sed -e "/^\$/q" patch11 >hdrs11 && 289 check_patch hdrs11 && 290 ! grep "^To: Someone <someone@out.there>\$" hdrs11 && ··· 294 test_expect_success '--no-cc overrides config.cc' ' 295 git config --replace-all format.cc \ 296 "C E Cipient <rcipient@example.com>" && 297 - git format-patch --no-cc --stdout master..side >patch12 && 298 sed -e "/^\$/q" patch12 >hdrs12 && 299 check_patch hdrs12 && 300 ! grep "^Cc: C E Cipient <rcipient@example.com>\$" hdrs12 ··· 303 test_expect_success '--no-add-header overrides config.headers' ' 304 git config --replace-all format.headers \ 305 "Header1: B E Cipient <rcipient@example.com>" && 306 - git format-patch --no-add-header --stdout master..side >patch13 && 307 sed -e "/^\$/q" patch13 >hdrs13 && 308 check_patch hdrs13 && 309 ! grep "^Header1: B E Cipient <rcipient@example.com>\$" hdrs13 ··· 312 test_expect_success 'multiple files' ' 313 rm -rf patches/ && 314 git checkout side && 315 - git format-patch -o patches/ master && 316 ls patches/0001-Side-changes-1.patch patches/0002-Side-changes-2.patch patches/0003-Side-changes-3-with-n-backslash-n-in-it.patch 317 ' 318 319 test_expect_success 'reroll count' ' 320 rm -fr patches && 321 - git format-patch -o patches --cover-letter --reroll-count 4 master..side >list && 322 ! grep -v "^patches/v4-000[0-3]-" list && 323 sed -n -e "/^Subject: /p" $(cat list) >subjects && 324 ! grep -v "^Subject: \[PATCH v4 [0-3]/3\] " subjects ··· 326 327 test_expect_success 'reroll count (-v)' ' 328 rm -fr patches && 329 - git format-patch -o patches --cover-letter -v4 master..side >list && 330 ! grep -v "^patches/v4-000[0-3]-" list && 331 sed -n -e "/^Subject: /p" $(cat list) >subjects && 332 ! grep -v "^Subject: \[PATCH v4 [0-3]/3\] " subjects ··· 362 363 test_expect_success 'no threading' ' 364 git checkout side && 365 - check_threading expect.no-threading master 366 ' 367 368 cat >expect.thread <<EOF ··· 379 EOF 380 381 test_expect_success 'thread' ' 382 - check_threading expect.thread --thread master 383 ' 384 385 cat >expect.in-reply-to <<EOF ··· 399 400 test_expect_success 'thread in-reply-to' ' 401 check_threading expect.in-reply-to --in-reply-to="<test.message>" \ 402 - --thread master 403 ' 404 405 cat >expect.cover-letter <<EOF ··· 420 EOF 421 422 test_expect_success 'thread cover-letter' ' 423 - check_threading expect.cover-letter --cover-letter --thread master 424 ' 425 426 cat >expect.cl-irt <<EOF ··· 447 448 test_expect_success 'thread cover-letter in-reply-to' ' 449 check_threading expect.cl-irt --cover-letter \ 450 - --in-reply-to="<test.message>" --thread master 451 ' 452 453 test_expect_success 'thread explicit shallow' ' 454 check_threading expect.cl-irt --cover-letter \ 455 - --in-reply-to="<test.message>" --thread=shallow master 456 ' 457 458 cat >expect.deep <<EOF ··· 470 EOF 471 472 test_expect_success 'thread deep' ' 473 - check_threading expect.deep --thread=deep master 474 ' 475 476 cat >expect.deep-irt <<EOF ··· 493 494 test_expect_success 'thread deep in-reply-to' ' 495 check_threading expect.deep-irt --thread=deep \ 496 - --in-reply-to="<test.message>" master 497 ' 498 499 cat >expect.deep-cl <<EOF ··· 517 EOF 518 519 test_expect_success 'thread deep cover-letter' ' 520 - check_threading expect.deep-cl --cover-letter --thread=deep master 521 ' 522 523 cat >expect.deep-cl-irt <<EOF ··· 547 548 test_expect_success 'thread deep cover-letter in-reply-to' ' 549 check_threading expect.deep-cl-irt --cover-letter \ 550 - --in-reply-to="<test.message>" --thread=deep master 551 ' 552 553 test_expect_success 'thread via config' ' 554 test_config format.thread true && 555 - check_threading expect.thread master 556 ' 557 558 test_expect_success 'thread deep via config' ' 559 test_config format.thread deep && 560 - check_threading expect.deep master 561 ' 562 563 test_expect_success 'thread config + override' ' 564 test_config format.thread deep && 565 - check_threading expect.thread --thread master 566 ' 567 568 test_expect_success 'thread config + --no-thread' ' 569 test_config format.thread deep && 570 - check_threading expect.no-threading --no-thread master 571 ' 572 573 test_expect_success 'excessive subject' ' ··· 580 after=$(git rev-parse --short $after) && 581 git update-index file && 582 git commit -m "This is an excessively long subject line for a message due to the habit some projects have of not having a short, one-line subject at the start of the commit message, but rather sticking a whole paragraph right at the start as the only thing in the commit message. It had better not become the filename for the patch." && 583 - git format-patch -o patches/ master..side && 584 ls patches/0004-This-is-an-excessively-long-subject-line-for-a-messa.patch 585 ' 586 ··· 842 ' 843 844 test_expect_success 'format-patch --numstat should produce a patch' ' 845 - git format-patch --numstat --stdout master..side >output && 846 grep "^diff --git a/" output >diff && 847 test_line_count = 5 diff 848 ' 849 850 test_expect_success 'format-patch -- <path>' ' 851 - git format-patch master..side -- file 2>error && 852 ! grep "Use .--" error 853 ' 854 ··· 1622 test_config branch.rebuild-1.description "config subject 1623 1624 body" && 1625 - test_must_fail git format-patch --cover-letter --cover-from-description garbage master && 1626 test_config format.coverFromDescription garbage && 1627 - test_must_fail git format-patch --cover-letter master 1628 ' 1629 1630 test_expect_success 'cover letter with format.coverFromDescription = default' ' ··· 1633 body" && 1634 test_config format.coverFromDescription default && 1635 git checkout rebuild-1 && 1636 - git format-patch --stdout --cover-letter master >actual && 1637 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1638 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1639 grep "^config subject$" actual && ··· 1645 1646 body" && 1647 git checkout rebuild-1 && 1648 - git format-patch --stdout --cover-letter --cover-from-description default master >actual && 1649 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1650 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1651 grep "^config subject$" actual && ··· 1658 body" && 1659 test_config format.coverFromDescription none && 1660 git checkout rebuild-1 && 1661 - git format-patch --stdout --cover-letter master >actual && 1662 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1663 grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1664 ! grep "^config subject$" actual && ··· 1670 1671 body" && 1672 git checkout rebuild-1 && 1673 - git format-patch --stdout --cover-letter --cover-from-description none master >actual && 1674 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1675 grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1676 ! grep "^config subject$" actual && ··· 1683 body" && 1684 test_config format.coverFromDescription message && 1685 git checkout rebuild-1 && 1686 - git format-patch --stdout --cover-letter master >actual && 1687 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1688 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1689 grep "^config subject$" actual && ··· 1695 1696 body" && 1697 git checkout rebuild-1 && 1698 - git format-patch --stdout --cover-letter --cover-from-description message master >actual && 1699 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1700 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1701 grep "^config subject$" actual && ··· 1708 body" && 1709 test_config format.coverFromDescription subject && 1710 git checkout rebuild-1 && 1711 - git format-patch --stdout --cover-letter master >actual && 1712 grep "^Subject: \[PATCH 0/2\] config subject$" actual && 1713 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1714 ! grep "^config subject$" actual && ··· 1720 1721 body" && 1722 git checkout rebuild-1 && 1723 - git format-patch --stdout --cover-letter --cover-from-description subject master >actual && 1724 grep "^Subject: \[PATCH 0/2\] config subject$" actual && 1725 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1726 ! grep "^config subject$" actual && ··· 1733 body" && 1734 test_config format.coverFromDescription auto && 1735 git checkout rebuild-1 && 1736 - git format-patch --stdout --cover-letter master >actual && 1737 grep "^Subject: \[PATCH 0/2\] config subject$" actual && 1738 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1739 ! grep "^config subject$" actual && ··· 1745 1746 body" && 1747 git checkout rebuild-1 && 1748 - git format-patch --stdout --cover-letter --cover-from-description auto master >actual && 1749 grep "^Subject: \[PATCH 0/2\] config subject$" actual && 1750 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1751 ! grep "^config subject$" actual && ··· 1758 body" && 1759 test_config format.coverFromDescription auto && 1760 git checkout rebuild-1 && 1761 - git format-patch --stdout --cover-letter master >actual && 1762 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1763 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1764 grep "^this is a really long first line and it is over 100 characters long which is the threshold for long subjects$" actual && ··· 1770 1771 body" && 1772 git checkout rebuild-1 && 1773 - git format-patch --stdout --cover-letter --cover-from-description auto master >actual && 1774 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1775 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1776 grep "^this is a really long first line and it is over 100 characters long which is the threshold for long subjects$" actual && ··· 1783 body" && 1784 test_config format.coverFromDescription none && 1785 git checkout rebuild-1 && 1786 - git format-patch --stdout --cover-letter --cover-from-description subject master >actual && 1787 grep "^Subject: \[PATCH 0/2\] config subject$" actual && 1788 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1789 ! grep "^config subject$" actual && ··· 1793 test_expect_success 'cover letter using branch description (1)' ' 1794 git checkout rebuild-1 && 1795 test_config branch.rebuild-1.description hello && 1796 - git format-patch --stdout --cover-letter master >actual && 1797 grep hello actual 1798 ' 1799 ··· 1807 test_expect_success 'cover letter using branch description (3)' ' 1808 git checkout rebuild-1 && 1809 test_config branch.rebuild-1.description hello && 1810 - git format-patch --stdout --cover-letter ^master rebuild-1 >actual && 1811 grep hello actual 1812 ' 1813 1814 test_expect_success 'cover letter using branch description (4)' ' 1815 git checkout rebuild-1 && 1816 test_config branch.rebuild-1.description hello && 1817 - git format-patch --stdout --cover-letter master.. >actual && 1818 grep hello actual 1819 ' 1820 ··· 1881 1882 test_expect_success 'format-patch -o with no leading directories' ' 1883 rm -fr patches && 1884 - git format-patch -o patches master..side && 1885 - count=$(git rev-list --count master..side) && 1886 ls patches >list && 1887 test_line_count = $count list 1888 ' ··· 1890 test_expect_success 'format-patch -o with leading existing directories' ' 1891 rm -rf existing-dir && 1892 mkdir existing-dir && 1893 - git format-patch -o existing-dir/patches master..side && 1894 - count=$(git rev-list --count master..side) && 1895 ls existing-dir/patches >list && 1896 test_line_count = $count list 1897 ' 1898 1899 test_expect_success 'format-patch -o with leading non-existing directories' ' 1900 rm -rf non-existing-dir && 1901 - git format-patch -o non-existing-dir/patches master..side && 1902 - count=$(git rev-list --count master..side) && 1903 test_path_is_dir non-existing-dir && 1904 ls non-existing-dir/patches >list && 1905 test_line_count = $count list ··· 1908 test_expect_success 'format-patch format.outputDirectory option' ' 1909 test_config format.outputDirectory patches && 1910 rm -fr patches && 1911 - git format-patch master..side && 1912 - count=$(git rev-list --count master..side) && 1913 ls patches >list && 1914 test_line_count = $count list 1915 ' ··· 1917 test_expect_success 'format-patch -o overrides format.outputDirectory' ' 1918 test_config format.outputDirectory patches && 1919 rm -fr patches patchset && 1920 - git format-patch master..side -o patchset && 1921 test_path_is_missing patches && 1922 test_path_is_dir patchset 1923 ' ··· 2014 # ------------W 2015 # 2016 # If "format-patch Z..X" is given, P and Z can not be specified as the base commit 2017 - git checkout -b topic1 master && 2018 git rev-parse HEAD >commit-id-base && 2019 test_commit P && 2020 git rev-parse HEAD >commit-id-P && 2021 test_commit Z && 2022 git rev-parse HEAD >commit-id-Z && 2023 test_commit Y && 2024 - git checkout -b topic2 master && 2025 test_commit W && 2026 git merge topic1 && 2027 test_commit X && ··· 2034 ' 2035 2036 test_expect_success 'format-patch --base=auto' ' 2037 - git checkout -b upstream master && 2038 git checkout -b local upstream && 2039 git branch --set-upstream-to=upstream && 2040 test_commit N1 && ··· 2055 # \ / \ 2056 # C---M2---E 2057 # 2058 - git checkout master && 2059 test_commit A && 2060 - git checkout -b xb master && 2061 test_commit B && 2062 - git checkout -b xc master && 2063 test_commit C && 2064 git checkout -b xbc xb -- && 2065 git merge xc && ··· 2179 ' 2180 2181 test_expect_success 'interdiff: setup' ' 2182 - git checkout -b boop master && 2183 test_commit fnorp blorp && 2184 test_commit fleep blorp 2185 '
··· 5 6 test_description='various format-patch tests' 7 8 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 35 test_tick && 36 git commit -m "Side changes #3 with \\n backslash-n in it." && 37 38 + git checkout main && 39 git diff-tree -p C2 >patch && 40 git apply --index <patch && 41 test_tick && 42 + git commit -m "Main accepts moral equivalent of #2" && 43 44 git checkout side && 45 git checkout -b patchid && ··· 59 test_tick && 60 git commit -m "patchid 3" && 61 62 + git checkout main 63 ' 64 65 test_expect_success 'format-patch --ignore-if-in-upstream' ' 66 + git format-patch --stdout main..side >patch0 && 67 grep "^From " patch0 >from0 && 68 test_line_count = 3 from0 69 ' 70 71 test_expect_success 'format-patch --ignore-if-in-upstream' ' 72 git format-patch --stdout \ 73 + --ignore-if-in-upstream main..side >patch1 && 74 grep "^From " patch1 >from1 && 75 test_line_count = 2 from1 76 ' 77 78 test_expect_success 'format-patch --ignore-if-in-upstream handles tags' ' 79 git tag -a v1 -m tag side && 80 + git tag -a v2 -m tag main && 81 git format-patch --stdout --ignore-if-in-upstream v2..v1 >patch1 && 82 grep "^From " patch1 >from1 && 83 test_line_count = 2 from1 84 ' 85 86 test_expect_success "format-patch doesn't consider merge commits" ' 87 + git checkout -b feature main && 88 echo "Another line" >>file && 89 test_tick && 90 git commit -am "Feature branch change #1" && 91 echo "Yet another line" >>file && 92 test_tick && 93 git commit -am "Feature branch change #2" && 94 + git checkout -b merger main && 95 test_tick && 96 git merge --no-ff feature && 97 git format-patch -3 --stdout >patch && ··· 100 ' 101 102 test_expect_success 'format-patch result applies' ' 103 + git checkout -b rebuild-0 main && 104 git am -3 patch0 && 105 + git rev-list main.. >list && 106 test_line_count = 2 list 107 ' 108 109 test_expect_success 'format-patch --ignore-if-in-upstream result applies' ' 110 + git checkout -b rebuild-1 main && 111 git am -3 patch1 && 112 + git rev-list main.. >list && 113 test_line_count = 2 list 114 ' 115 ··· 133 " && 134 git config --add format.headers "Cc: S E Cipient <scipient@example.com> 135 " && 136 + git format-patch --stdout main..side >patch2 && 137 sed -e "/^\$/q" patch2 >hdrs2 && 138 grep "^To: R E Cipient <rcipient@example.com>\$" hdrs2 && 139 grep "^Cc: S E Cipient <scipient@example.com>\$" hdrs2 ··· 142 test_expect_success 'extra headers without newlines' ' 143 git config --replace-all format.headers "To: R E Cipient <rcipient@example.com>" && 144 git config --add format.headers "Cc: S E Cipient <scipient@example.com>" && 145 + git format-patch --stdout main..side >patch3 && 146 sed -e "/^\$/q" patch3 >hdrs3 && 147 grep "^To: R E Cipient <rcipient@example.com>\$" hdrs3 && 148 grep "^Cc: S E Cipient <scipient@example.com>\$" hdrs3 ··· 151 test_expect_success 'extra headers with multiple To:s' ' 152 git config --replace-all format.headers "To: R E Cipient <rcipient@example.com>" && 153 git config --add format.headers "To: S E Cipient <scipient@example.com>" && 154 + git format-patch --stdout main..side >patch4 && 155 sed -e "/^\$/q" patch4 >hdrs4 && 156 grep "^To: R E Cipient <rcipient@example.com>,\$" hdrs4 && 157 grep "^ *S E Cipient <scipient@example.com>\$" hdrs4 ··· 159 160 test_expect_success 'additional command line cc (ascii)' ' 161 git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" && 162 + git format-patch --cc="S E Cipient <scipient@example.com>" --stdout main..side >patch5 && 163 sed -e "/^\$/q" patch5 >hdrs5 && 164 grep "^Cc: R E Cipient <rcipient@example.com>,\$" hdrs5 && 165 grep "^ *S E Cipient <scipient@example.com>\$" hdrs5 ··· 167 168 test_expect_failure 'additional command line cc (rfc822)' ' 169 git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" && 170 + git format-patch --cc="S. E. Cipient <scipient@example.com>" --stdout main..side >patch5 && 171 sed -e "/^\$/q" patch5 >hdrs5 && 172 grep "^Cc: R E Cipient <rcipient@example.com>,\$" hdrs5 && 173 grep "^ *\"S. E. Cipient\" <scipient@example.com>\$" hdrs5 ··· 175 176 test_expect_success 'command line headers' ' 177 git config --unset-all format.headers && 178 + git format-patch --add-header="Cc: R E Cipient <rcipient@example.com>" --stdout main..side >patch6 && 179 sed -e "/^\$/q" patch6 >hdrs6 && 180 grep "^Cc: R E Cipient <rcipient@example.com>\$" hdrs6 181 ' 182 183 test_expect_success 'configuration headers and command line headers' ' 184 git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" && 185 + git format-patch --add-header="Cc: S E Cipient <scipient@example.com>" --stdout main..side >patch7 && 186 sed -e "/^\$/q" patch7 >hdrs7 && 187 grep "^Cc: R E Cipient <rcipient@example.com>,\$" hdrs7 && 188 grep "^ *S E Cipient <scipient@example.com>\$" hdrs7 ··· 190 191 test_expect_success 'command line To: header (ascii)' ' 192 git config --unset-all format.headers && 193 + git format-patch --to="R E Cipient <rcipient@example.com>" --stdout main..side >patch8 && 194 sed -e "/^\$/q" patch8 >hdrs8 && 195 grep "^To: R E Cipient <rcipient@example.com>\$" hdrs8 196 ' 197 198 test_expect_failure 'command line To: header (rfc822)' ' 199 + git format-patch --to="R. E. Cipient <rcipient@example.com>" --stdout main..side >patch8 && 200 sed -e "/^\$/q" patch8 >hdrs8 && 201 grep "^To: \"R. E. Cipient\" <rcipient@example.com>\$" hdrs8 202 ' 203 204 test_expect_failure 'command line To: header (rfc2047)' ' 205 + git format-patch --to="R Ä Cipient <rcipient@example.com>" --stdout main..side >patch8 && 206 sed -e "/^\$/q" patch8 >hdrs8 && 207 grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" hdrs8 208 ' 209 210 test_expect_success 'configuration To: header (ascii)' ' 211 git config format.to "R E Cipient <rcipient@example.com>" && 212 + git format-patch --stdout main..side >patch9 && 213 sed -e "/^\$/q" patch9 >hdrs9 && 214 grep "^To: R E Cipient <rcipient@example.com>\$" hdrs9 215 ' 216 217 test_expect_failure 'configuration To: header (rfc822)' ' 218 git config format.to "R. E. Cipient <rcipient@example.com>" && 219 + git format-patch --stdout main..side >patch9 && 220 sed -e "/^\$/q" patch9 >hdrs9 && 221 grep "^To: \"R. E. Cipient\" <rcipient@example.com>\$" hdrs9 222 ' 223 224 test_expect_failure 'configuration To: header (rfc2047)' ' 225 git config format.to "R Ä Cipient <rcipient@example.com>" && 226 + git format-patch --stdout main..side >patch9 && 227 sed -e "/^\$/q" patch9 >hdrs9 && 228 grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" hdrs9 229 ' ··· 237 } 238 239 test_expect_success 'format.from=false' ' 240 + git -c format.from=false format-patch --stdout main..side >patch && 241 sed -e "/^\$/q" patch >hdrs && 242 check_patch patch && 243 ! grep "^From: C O Mitter <committer@example.com>\$" hdrs 244 ' 245 246 test_expect_success 'format.from=true' ' 247 + git -c format.from=true format-patch --stdout main..side >patch && 248 sed -e "/^\$/q" patch >hdrs && 249 check_patch hdrs && 250 grep "^From: C O Mitter <committer@example.com>\$" hdrs 251 ' 252 253 test_expect_success 'format.from with address' ' 254 + git -c format.from="F R Om <from@example.com>" format-patch --stdout main..side >patch && 255 sed -e "/^\$/q" patch >hdrs && 256 check_patch hdrs && 257 grep "^From: F R Om <from@example.com>\$" hdrs 258 ' 259 260 test_expect_success '--no-from overrides format.from' ' 261 + git -c format.from="F R Om <from@example.com>" format-patch --no-from --stdout main..side >patch && 262 sed -e "/^\$/q" patch >hdrs && 263 check_patch hdrs && 264 ! grep "^From: F R Om <from@example.com>\$" hdrs 265 ' 266 267 test_expect_success '--from overrides format.from' ' 268 + git -c format.from="F R Om <from@example.com>" format-patch --from --stdout main..side >patch && 269 sed -e "/^\$/q" patch >hdrs && 270 check_patch hdrs && 271 ! grep "^From: F R Om <from@example.com>\$" hdrs ··· 274 test_expect_success '--no-to overrides config.to' ' 275 git config --replace-all format.to \ 276 "R E Cipient <rcipient@example.com>" && 277 + git format-patch --no-to --stdout main..side >patch10 && 278 sed -e "/^\$/q" patch10 >hdrs10 && 279 check_patch hdrs10 && 280 ! grep "^To: R E Cipient <rcipient@example.com>\$" hdrs10 ··· 284 git config --replace-all format.to \ 285 "Someone <someone@out.there>" && 286 git format-patch --no-to --to="Someone Else <else@out.there>" \ 287 + --stdout main..side >patch11 && 288 sed -e "/^\$/q" patch11 >hdrs11 && 289 check_patch hdrs11 && 290 ! grep "^To: Someone <someone@out.there>\$" hdrs11 && ··· 294 test_expect_success '--no-cc overrides config.cc' ' 295 git config --replace-all format.cc \ 296 "C E Cipient <rcipient@example.com>" && 297 + git format-patch --no-cc --stdout main..side >patch12 && 298 sed -e "/^\$/q" patch12 >hdrs12 && 299 check_patch hdrs12 && 300 ! grep "^Cc: C E Cipient <rcipient@example.com>\$" hdrs12 ··· 303 test_expect_success '--no-add-header overrides config.headers' ' 304 git config --replace-all format.headers \ 305 "Header1: B E Cipient <rcipient@example.com>" && 306 + git format-patch --no-add-header --stdout main..side >patch13 && 307 sed -e "/^\$/q" patch13 >hdrs13 && 308 check_patch hdrs13 && 309 ! grep "^Header1: B E Cipient <rcipient@example.com>\$" hdrs13 ··· 312 test_expect_success 'multiple files' ' 313 rm -rf patches/ && 314 git checkout side && 315 + git format-patch -o patches/ main && 316 ls patches/0001-Side-changes-1.patch patches/0002-Side-changes-2.patch patches/0003-Side-changes-3-with-n-backslash-n-in-it.patch 317 ' 318 319 test_expect_success 'reroll count' ' 320 rm -fr patches && 321 + git format-patch -o patches --cover-letter --reroll-count 4 main..side >list && 322 ! grep -v "^patches/v4-000[0-3]-" list && 323 sed -n -e "/^Subject: /p" $(cat list) >subjects && 324 ! grep -v "^Subject: \[PATCH v4 [0-3]/3\] " subjects ··· 326 327 test_expect_success 'reroll count (-v)' ' 328 rm -fr patches && 329 + git format-patch -o patches --cover-letter -v4 main..side >list && 330 ! grep -v "^patches/v4-000[0-3]-" list && 331 sed -n -e "/^Subject: /p" $(cat list) >subjects && 332 ! grep -v "^Subject: \[PATCH v4 [0-3]/3\] " subjects ··· 362 363 test_expect_success 'no threading' ' 364 git checkout side && 365 + check_threading expect.no-threading main 366 ' 367 368 cat >expect.thread <<EOF ··· 379 EOF 380 381 test_expect_success 'thread' ' 382 + check_threading expect.thread --thread main 383 ' 384 385 cat >expect.in-reply-to <<EOF ··· 399 400 test_expect_success 'thread in-reply-to' ' 401 check_threading expect.in-reply-to --in-reply-to="<test.message>" \ 402 + --thread main 403 ' 404 405 cat >expect.cover-letter <<EOF ··· 420 EOF 421 422 test_expect_success 'thread cover-letter' ' 423 + check_threading expect.cover-letter --cover-letter --thread main 424 ' 425 426 cat >expect.cl-irt <<EOF ··· 447 448 test_expect_success 'thread cover-letter in-reply-to' ' 449 check_threading expect.cl-irt --cover-letter \ 450 + --in-reply-to="<test.message>" --thread main 451 ' 452 453 test_expect_success 'thread explicit shallow' ' 454 check_threading expect.cl-irt --cover-letter \ 455 + --in-reply-to="<test.message>" --thread=shallow main 456 ' 457 458 cat >expect.deep <<EOF ··· 470 EOF 471 472 test_expect_success 'thread deep' ' 473 + check_threading expect.deep --thread=deep main 474 ' 475 476 cat >expect.deep-irt <<EOF ··· 493 494 test_expect_success 'thread deep in-reply-to' ' 495 check_threading expect.deep-irt --thread=deep \ 496 + --in-reply-to="<test.message>" main 497 ' 498 499 cat >expect.deep-cl <<EOF ··· 517 EOF 518 519 test_expect_success 'thread deep cover-letter' ' 520 + check_threading expect.deep-cl --cover-letter --thread=deep main 521 ' 522 523 cat >expect.deep-cl-irt <<EOF ··· 547 548 test_expect_success 'thread deep cover-letter in-reply-to' ' 549 check_threading expect.deep-cl-irt --cover-letter \ 550 + --in-reply-to="<test.message>" --thread=deep main 551 ' 552 553 test_expect_success 'thread via config' ' 554 test_config format.thread true && 555 + check_threading expect.thread main 556 ' 557 558 test_expect_success 'thread deep via config' ' 559 test_config format.thread deep && 560 + check_threading expect.deep main 561 ' 562 563 test_expect_success 'thread config + override' ' 564 test_config format.thread deep && 565 + check_threading expect.thread --thread main 566 ' 567 568 test_expect_success 'thread config + --no-thread' ' 569 test_config format.thread deep && 570 + check_threading expect.no-threading --no-thread main 571 ' 572 573 test_expect_success 'excessive subject' ' ··· 580 after=$(git rev-parse --short $after) && 581 git update-index file && 582 git commit -m "This is an excessively long subject line for a message due to the habit some projects have of not having a short, one-line subject at the start of the commit message, but rather sticking a whole paragraph right at the start as the only thing in the commit message. It had better not become the filename for the patch." && 583 + git format-patch -o patches/ main..side && 584 ls patches/0004-This-is-an-excessively-long-subject-line-for-a-messa.patch 585 ' 586 ··· 842 ' 843 844 test_expect_success 'format-patch --numstat should produce a patch' ' 845 + git format-patch --numstat --stdout main..side >output && 846 grep "^diff --git a/" output >diff && 847 test_line_count = 5 diff 848 ' 849 850 test_expect_success 'format-patch -- <path>' ' 851 + git format-patch main..side -- file 2>error && 852 ! grep "Use .--" error 853 ' 854 ··· 1622 test_config branch.rebuild-1.description "config subject 1623 1624 body" && 1625 + test_must_fail git format-patch --cover-letter --cover-from-description garbage main && 1626 test_config format.coverFromDescription garbage && 1627 + test_must_fail git format-patch --cover-letter main 1628 ' 1629 1630 test_expect_success 'cover letter with format.coverFromDescription = default' ' ··· 1633 body" && 1634 test_config format.coverFromDescription default && 1635 git checkout rebuild-1 && 1636 + git format-patch --stdout --cover-letter main >actual && 1637 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1638 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1639 grep "^config subject$" actual && ··· 1645 1646 body" && 1647 git checkout rebuild-1 && 1648 + git format-patch --stdout --cover-letter --cover-from-description default main >actual && 1649 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1650 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1651 grep "^config subject$" actual && ··· 1658 body" && 1659 test_config format.coverFromDescription none && 1660 git checkout rebuild-1 && 1661 + git format-patch --stdout --cover-letter main >actual && 1662 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1663 grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1664 ! grep "^config subject$" actual && ··· 1670 1671 body" && 1672 git checkout rebuild-1 && 1673 + git format-patch --stdout --cover-letter --cover-from-description none main >actual && 1674 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1675 grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1676 ! grep "^config subject$" actual && ··· 1683 body" && 1684 test_config format.coverFromDescription message && 1685 git checkout rebuild-1 && 1686 + git format-patch --stdout --cover-letter main >actual && 1687 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1688 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1689 grep "^config subject$" actual && ··· 1695 1696 body" && 1697 git checkout rebuild-1 && 1698 + git format-patch --stdout --cover-letter --cover-from-description message main >actual && 1699 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1700 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1701 grep "^config subject$" actual && ··· 1708 body" && 1709 test_config format.coverFromDescription subject && 1710 git checkout rebuild-1 && 1711 + git format-patch --stdout --cover-letter main >actual && 1712 grep "^Subject: \[PATCH 0/2\] config subject$" actual && 1713 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1714 ! grep "^config subject$" actual && ··· 1720 1721 body" && 1722 git checkout rebuild-1 && 1723 + git format-patch --stdout --cover-letter --cover-from-description subject main >actual && 1724 grep "^Subject: \[PATCH 0/2\] config subject$" actual && 1725 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1726 ! grep "^config subject$" actual && ··· 1733 body" && 1734 test_config format.coverFromDescription auto && 1735 git checkout rebuild-1 && 1736 + git format-patch --stdout --cover-letter main >actual && 1737 grep "^Subject: \[PATCH 0/2\] config subject$" actual && 1738 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1739 ! grep "^config subject$" actual && ··· 1745 1746 body" && 1747 git checkout rebuild-1 && 1748 + git format-patch --stdout --cover-letter --cover-from-description auto main >actual && 1749 grep "^Subject: \[PATCH 0/2\] config subject$" actual && 1750 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1751 ! grep "^config subject$" actual && ··· 1758 body" && 1759 test_config format.coverFromDescription auto && 1760 git checkout rebuild-1 && 1761 + git format-patch --stdout --cover-letter main >actual && 1762 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1763 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1764 grep "^this is a really long first line and it is over 100 characters long which is the threshold for long subjects$" actual && ··· 1770 1771 body" && 1772 git checkout rebuild-1 && 1773 + git format-patch --stdout --cover-letter --cover-from-description auto main >actual && 1774 grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual && 1775 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1776 grep "^this is a really long first line and it is over 100 characters long which is the threshold for long subjects$" actual && ··· 1783 body" && 1784 test_config format.coverFromDescription none && 1785 git checkout rebuild-1 && 1786 + git format-patch --stdout --cover-letter --cover-from-description subject main >actual && 1787 grep "^Subject: \[PATCH 0/2\] config subject$" actual && 1788 ! grep "^\*\*\* BLURB HERE \*\*\*$" actual && 1789 ! grep "^config subject$" actual && ··· 1793 test_expect_success 'cover letter using branch description (1)' ' 1794 git checkout rebuild-1 && 1795 test_config branch.rebuild-1.description hello && 1796 + git format-patch --stdout --cover-letter main >actual && 1797 grep hello actual 1798 ' 1799 ··· 1807 test_expect_success 'cover letter using branch description (3)' ' 1808 git checkout rebuild-1 && 1809 test_config branch.rebuild-1.description hello && 1810 + git format-patch --stdout --cover-letter ^main rebuild-1 >actual && 1811 grep hello actual 1812 ' 1813 1814 test_expect_success 'cover letter using branch description (4)' ' 1815 git checkout rebuild-1 && 1816 test_config branch.rebuild-1.description hello && 1817 + git format-patch --stdout --cover-letter main.. >actual && 1818 grep hello actual 1819 ' 1820 ··· 1881 1882 test_expect_success 'format-patch -o with no leading directories' ' 1883 rm -fr patches && 1884 + git format-patch -o patches main..side && 1885 + count=$(git rev-list --count main..side) && 1886 ls patches >list && 1887 test_line_count = $count list 1888 ' ··· 1890 test_expect_success 'format-patch -o with leading existing directories' ' 1891 rm -rf existing-dir && 1892 mkdir existing-dir && 1893 + git format-patch -o existing-dir/patches main..side && 1894 + count=$(git rev-list --count main..side) && 1895 ls existing-dir/patches >list && 1896 test_line_count = $count list 1897 ' 1898 1899 test_expect_success 'format-patch -o with leading non-existing directories' ' 1900 rm -rf non-existing-dir && 1901 + git format-patch -o non-existing-dir/patches main..side && 1902 + count=$(git rev-list --count main..side) && 1903 test_path_is_dir non-existing-dir && 1904 ls non-existing-dir/patches >list && 1905 test_line_count = $count list ··· 1908 test_expect_success 'format-patch format.outputDirectory option' ' 1909 test_config format.outputDirectory patches && 1910 rm -fr patches && 1911 + git format-patch main..side && 1912 + count=$(git rev-list --count main..side) && 1913 ls patches >list && 1914 test_line_count = $count list 1915 ' ··· 1917 test_expect_success 'format-patch -o overrides format.outputDirectory' ' 1918 test_config format.outputDirectory patches && 1919 rm -fr patches patchset && 1920 + git format-patch main..side -o patchset && 1921 test_path_is_missing patches && 1922 test_path_is_dir patchset 1923 ' ··· 2014 # ------------W 2015 # 2016 # If "format-patch Z..X" is given, P and Z can not be specified as the base commit 2017 + git checkout -b topic1 main && 2018 git rev-parse HEAD >commit-id-base && 2019 test_commit P && 2020 git rev-parse HEAD >commit-id-P && 2021 test_commit Z && 2022 git rev-parse HEAD >commit-id-Z && 2023 test_commit Y && 2024 + git checkout -b topic2 main && 2025 test_commit W && 2026 git merge topic1 && 2027 test_commit X && ··· 2034 ' 2035 2036 test_expect_success 'format-patch --base=auto' ' 2037 + git checkout -b upstream main && 2038 git checkout -b local upstream && 2039 git branch --set-upstream-to=upstream && 2040 test_commit N1 && ··· 2055 # \ / \ 2056 # C---M2---E 2057 # 2058 + git checkout main && 2059 test_commit A && 2060 + git checkout -b xb main && 2061 test_commit B && 2062 + git checkout -b xc main && 2063 test_commit C && 2064 git checkout -b xbc xb -- && 2065 git merge xc && ··· 2179 ' 2180 2181 test_expect_success 'interdiff: setup' ' 2182 + git checkout -b boop main && 2183 test_commit fnorp blorp && 2184 test_commit fleep blorp 2185 '
+2 -2
t/t4017-diff-retval.sh
··· 2 3 test_description='Return value of diffs' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 114 git checkout HEAD^ && 115 echo binary >>b && 116 git commit -m "side" b && 117 - test_must_fail git merge master && 118 git add b && 119 test_expect_code 2 git --no-pager diff --cached --check >test.out && 120 test 3 = $(grep "conflict marker" test.out | wc -l) &&
··· 2 3 test_description='Return value of diffs' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 114 git checkout HEAD^ && 115 echo binary >>b && 116 git commit -m "side" b && 117 + test_must_fail git merge main && 118 git add b && 119 test_expect_code 2 git --no-pager diff --cached --check >test.out && 120 test 3 = $(grep "conflict marker" test.out | wc -l) &&
+8 -8
t/t4038-diff-combined.sh
··· 2 3 test_description='combined diff' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 118 ' 119 120 test_expect_success 'setup combined ignore spaces' ' 121 - git checkout master && 122 >test && 123 git add test && 124 git commit -m initial && ··· 146 EOF 147 git commit -m "test other space changes" -a && 148 149 - test_must_fail git merge master && 150 tr -d Q <<-\EOF >test && 151 eol spaces Q 152 space change ··· 407 test_expect_success 'combine diff gets tree sorting right' ' 408 # create a directory and a file that sort differently in trees 409 # versus byte-wise (implied "/" sorts after ".") 410 - git checkout -f master && 411 mkdir foo && 412 echo base >foo/one && 413 echo base >foo/two && ··· 417 418 # one side modifies a file in the directory, along with the root 419 # file... 420 - echo master >foo/one && 421 - echo master >foo.ext && 422 - git commit -a -m master && 423 424 # the other side modifies the other file in the directory 425 git checkout -b other HEAD^ && ··· 429 # And now we merge. The files in the subdirectory will resolve cleanly, 430 # meaning that a combined diff will not find them interesting. But it 431 # will find the tree itself interesting, because it had to be merged. 432 - git checkout master && 433 git merge other && 434 435 printf "MM\tfoo\n" >expect &&
··· 2 3 test_description='combined diff' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 118 ' 119 120 test_expect_success 'setup combined ignore spaces' ' 121 + git checkout main && 122 >test && 123 git add test && 124 git commit -m initial && ··· 146 EOF 147 git commit -m "test other space changes" -a && 148 149 + test_must_fail git merge main && 150 tr -d Q <<-\EOF >test && 151 eol spaces Q 152 space change ··· 407 test_expect_success 'combine diff gets tree sorting right' ' 408 # create a directory and a file that sort differently in trees 409 # versus byte-wise (implied "/" sorts after ".") 410 + git checkout -f main && 411 mkdir foo && 412 echo base >foo/one && 413 echo base >foo/two && ··· 417 418 # one side modifies a file in the directory, along with the root 419 # file... 420 + echo main >foo/one && 421 + echo main >foo.ext && 422 + git commit -a -m main && 423 424 # the other side modifies the other file in the directory 425 git checkout -b other HEAD^ && ··· 429 # And now we merge. The files in the subdirectory will resolve cleanly, 430 # meaning that a combined diff will not find them interesting. But it 431 # will find the tree itself interesting, because it had to be merged. 432 + git checkout main && 433 git merge other && 434 435 printf "MM\tfoo\n" >expect &&
+2 -2
t/t4041-diff-submodule-option.sh
··· 9 This test tries to verify the sanity of the --submodule option of git diff. 10 ' 11 12 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 13 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 14 15 . ./test-lib.sh ··· 541 (cd super && 542 (cd sub && 543 git fetch && 544 - git checkout origin/master 545 ) && 546 git diff --submodule > ../actual 547 ) &&
··· 9 This test tries to verify the sanity of the --submodule option of git diff. 10 ' 11 12 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 13 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 14 15 . ./test-lib.sh ··· 541 (cd super && 542 (cd sub && 543 git fetch && 544 + git checkout origin/main 545 ) && 546 git diff --submodule > ../actual 547 ) &&
+6 -6
t/t4048-diff-combined-binary.sh
··· 1 #!/bin/sh 2 3 test_description='combined and merge diff handle binary files and textconv' 4 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh ··· 17 echo threeQ3 | q_to_nul >binary && 18 git commit -a -m three && 19 three=$(git rev-parse --short HEAD:binary) && 20 - test_must_fail git merge master && 21 echo resolvedQhooray | q_to_nul >binary && 22 git commit -a -m resolved && 23 res=$(git rev-parse --short HEAD:binary) ··· 65 ' 66 67 test_expect_success 'setup non-binary with binary attribute' ' 68 - git checkout master && 69 test_commit one text && 70 test_commit two text && 71 two=$(git rev-parse --short HEAD:text) && 72 git checkout -b branch-text HEAD^ && 73 test_commit three text && 74 three=$(git rev-parse --short HEAD:text) && 75 - test_must_fail git merge master && 76 test_commit resolved text && 77 res=$(git rev-parse --short HEAD:text) && 78 echo text -diff >.gitattributes ··· 209 +THREE 210 ++======= 211 + TWO 212 - ++>>>>>>> MASTER 213 EOF 214 test_expect_success 'diff --cc respects textconv on worktree file' ' 215 git reset --hard HEAD^ && 216 - test_must_fail git merge master && 217 git diff >actual && 218 test_cmp expect actual 219 '
··· 1 #!/bin/sh 2 3 test_description='combined and merge diff handle binary files and textconv' 4 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh ··· 17 echo threeQ3 | q_to_nul >binary && 18 git commit -a -m three && 19 three=$(git rev-parse --short HEAD:binary) && 20 + test_must_fail git merge main && 21 echo resolvedQhooray | q_to_nul >binary && 22 git commit -a -m resolved && 23 res=$(git rev-parse --short HEAD:binary) ··· 65 ' 66 67 test_expect_success 'setup non-binary with binary attribute' ' 68 + git checkout main && 69 test_commit one text && 70 test_commit two text && 71 two=$(git rev-parse --short HEAD:text) && 72 git checkout -b branch-text HEAD^ && 73 test_commit three text && 74 three=$(git rev-parse --short HEAD:text) && 75 + test_must_fail git merge main && 76 test_commit resolved text && 77 res=$(git rev-parse --short HEAD:text) && 78 echo text -diff >.gitattributes ··· 209 +THREE 210 ++======= 211 + TWO 212 + ++>>>>>>> MAIN 213 EOF 214 test_expect_success 'diff --cc respects textconv on worktree file' ' 215 git reset --hard HEAD^ && 216 + test_must_fail git merge main && 217 git diff >actual && 218 test_cmp expect actual 219 '
+3 -3
t/t4052-stat-output.sh
··· 5 6 test_description='test --stat output of various commands' 7 8 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 356 EOF 357 test_expect_success 'merge --stat respects COLUMNS (big change)' ' 358 git checkout -b branch HEAD^^ && 359 - COLUMNS=100 git merge --stat --no-ff master^ >output && 360 grep " | " output >actual && 361 test_cmp expect actual 362 ' ··· 365 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++ 366 EOF 367 test_expect_success 'merge --stat respects COLUMNS (long filename)' ' 368 - COLUMNS=100 git merge --stat --no-ff master >output && 369 grep " | " output >actual && 370 test_cmp expect actual 371 '
··· 5 6 test_description='test --stat output of various commands' 7 8 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 356 EOF 357 test_expect_success 'merge --stat respects COLUMNS (big change)' ' 358 git checkout -b branch HEAD^^ && 359 + COLUMNS=100 git merge --stat --no-ff main^ >output && 360 grep " | " output >actual && 361 test_cmp expect actual 362 ' ··· 365 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++ 366 EOF 367 test_expect_success 'merge --stat respects COLUMNS (long filename)' ' 368 + COLUMNS=100 git merge --stat --no-ff main >output && 369 grep " | " output >actual && 370 test_cmp expect actual 371 '
+2 -2
t/t4056-diff-order.sh
··· 2 3 test_description='diff order' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 109 test_expect_success 'setup for testing combine-diff order' ' 110 git checkout -b tmp HEAD~ && 111 create_files 3 && 112 - git checkout master && 113 git merge --no-commit -s ours tmp && 114 create_files 5 115 '
··· 2 3 test_description='diff order' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 109 test_expect_success 'setup for testing combine-diff order' ' 110 git checkout -b tmp HEAD~ && 111 create_files 3 && 112 + git checkout main && 113 git merge --no-commit -s ours tmp && 114 create_files 5 115 '
+11 -11
t/t4057-diff-combined-paths.sh
··· 2 3 test_description='combined diff show only paths that are different to all parents' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 27 echo $i/2 >>$i.txt 28 done && 29 git commit -a -m "side 2-9" && 30 - git checkout master && 31 echo 1/2 >1.txt && 32 - git commit -a -m "master 1" && 33 git merge side && 34 >diffc.expect && 35 diffc_verify ··· 44 done && 45 echo "4side" >>4.txt && 46 git commit -a -m "side 2-9 +4" && 47 - git checkout master && 48 for i in $(test_seq 1 9) 49 do 50 echo $i/3 >>$i.txt 51 done && 52 - echo "4master" >>4.txt && 53 - git commit -a -m "master 1-9 +4" && 54 test_must_fail git merge side && 55 cat <<-\EOF >4.txt && 56 4 57 4/2 58 4/3 59 - 4master 60 4side 61 EOF 62 git add 4.txt && ··· 72 echo $i/4 >>$i.txt 73 done && 74 git commit -a -m "side 5-9" && 75 - git checkout master && 76 for i in $(test_seq 1 3) 77 do 78 echo $i/4 >>$i.txt 79 done && 80 - git commit -a -m "master 1-3 +4hello" && 81 git merge side && 82 echo "Hello World" >4hello.txt && 83 git add 4hello.txt && ··· 93 echo $i/5 >>$i.txt 94 done && 95 git commit -a -m "side 5-9" && 96 - git checkout master && 97 for i in $(test_seq 1 3) 98 do 99 echo $i/4 >>$i.txt 100 done && 101 - git commit -a -m "master 1-3" && 102 git merge side && 103 git rm 4.txt && 104 git commit --amend &&
··· 2 3 test_description='combined diff show only paths that are different to all parents' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 27 echo $i/2 >>$i.txt 28 done && 29 git commit -a -m "side 2-9" && 30 + git checkout main && 31 echo 1/2 >1.txt && 32 + git commit -a -m "main 1" && 33 git merge side && 34 >diffc.expect && 35 diffc_verify ··· 44 done && 45 echo "4side" >>4.txt && 46 git commit -a -m "side 2-9 +4" && 47 + git checkout main && 48 for i in $(test_seq 1 9) 49 do 50 echo $i/3 >>$i.txt 51 done && 52 + echo "4main" >>4.txt && 53 + git commit -a -m "main 1-9 +4" && 54 test_must_fail git merge side && 55 cat <<-\EOF >4.txt && 56 4 57 4/2 58 4/3 59 + 4main 60 4side 61 EOF 62 git add 4.txt && ··· 72 echo $i/4 >>$i.txt 73 done && 74 git commit -a -m "side 5-9" && 75 + git checkout main && 76 for i in $(test_seq 1 3) 77 do 78 echo $i/4 >>$i.txt 79 done && 80 + git commit -a -m "main 1-3 +4hello" && 81 git merge side && 82 echo "Hello World" >4hello.txt && 83 git add 4hello.txt && ··· 93 echo $i/5 >>$i.txt 94 done && 95 git commit -a -m "side 5-9" && 96 + git checkout main && 97 for i in $(test_seq 1 3) 98 do 99 echo $i/4 >>$i.txt 100 done && 101 + git commit -a -m "main 1-3" && 102 git merge side && 103 git rm 4.txt && 104 git commit --amend &&
+13 -13
t/t4061-diff-indent.sh
··· 3 test_description='Test diff indent heuristic. 4 5 ' 6 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 7 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 8 9 . ./test-lib.sh ··· 269 git reset --soft HEAD~ && 270 git diff-index --indent-heuristic -p old -- spaces.txt >out-diff-index-compacted && 271 compare_diff spaces-compacted-expect out-diff-index-compacted && 272 - git checkout -f master 273 ' 274 275 test_expect_success 'diff-index: nice spaces with diff.indentHeuristic=true' ' ··· 277 git reset --soft HEAD~ && 278 git -c diff.indentHeuristic=true diff-index -p old -- spaces.txt >out-diff-index-compacted2 && 279 compare_diff spaces-compacted-expect out-diff-index-compacted2 && 280 - git checkout -f master 281 ' 282 283 test_expect_success 'diff-index: ugly spaces with --no-indent-heuristic' ' ··· 285 git reset --soft HEAD~ && 286 git diff-index --no-indent-heuristic -p old -- spaces.txt >out-diff-index && 287 compare_diff spaces-expect out-diff-index && 288 - git checkout -f master 289 ' 290 291 test_expect_success 'diff-index: ugly spaces with diff.indentHeuristic=false' ' ··· 293 git reset --soft HEAD~ && 294 git -c diff.indentHeuristic=false diff-index -p old -- spaces.txt >out-diff-index2 && 295 compare_diff spaces-expect out-diff-index2 && 296 - git checkout -f master 297 ' 298 299 test_expect_success 'diff-index: --indent-heuristic overrides config' ' ··· 301 git reset --soft HEAD~ && 302 git -c diff.indentHeuristic=false diff-index --indent-heuristic -p old -- spaces.txt >out-diff-index-compacted3 && 303 compare_diff spaces-compacted-expect out-diff-index-compacted3 && 304 - git checkout -f master 305 ' 306 307 test_expect_success 'diff-index: --no-indent-heuristic overrides config' ' ··· 309 git reset --soft HEAD~ && 310 git -c diff.indentHeuristic=true diff-index --no-indent-heuristic -p old -- spaces.txt >out-diff-index3 && 311 compare_diff spaces-expect out-diff-index3 && 312 - git checkout -f master 313 ' 314 315 # --- diff-files tests ---------------------------------------------------- ··· 320 git diff-files --indent-heuristic -p spaces.txt >out-diff-files-raw && 321 grep -v index out-diff-files-raw >out-diff-files-compacted && 322 compare_diff spaces-compacted-expect out-diff-files-compacted && 323 - git checkout -f master 324 ' 325 326 test_expect_success 'diff-files: nice spaces with diff.indentHeuristic=true' ' ··· 329 git -c diff.indentHeuristic=true diff-files -p spaces.txt >out-diff-files-raw2 && 330 grep -v index out-diff-files-raw2 >out-diff-files-compacted2 && 331 compare_diff spaces-compacted-expect out-diff-files-compacted2 && 332 - git checkout -f master 333 ' 334 335 test_expect_success 'diff-files: ugly spaces with --no-indent-heuristic' ' ··· 338 git diff-files --no-indent-heuristic -p spaces.txt >out-diff-files-raw && 339 grep -v index out-diff-files-raw >out-diff-files && 340 compare_diff spaces-expect out-diff-files && 341 - git checkout -f master 342 ' 343 344 test_expect_success 'diff-files: ugly spaces with diff.indentHeuristic=false' ' ··· 347 git -c diff.indentHeuristic=false diff-files -p spaces.txt >out-diff-files-raw2 && 348 grep -v index out-diff-files-raw2 >out-diff-files && 349 compare_diff spaces-expect out-diff-files && 350 - git checkout -f master 351 ' 352 353 test_expect_success 'diff-files: --indent-heuristic overrides config' ' ··· 356 git -c diff.indentHeuristic=false diff-files --indent-heuristic -p spaces.txt >out-diff-files-raw3 && 357 grep -v index out-diff-files-raw3 >out-diff-files-compacted && 358 compare_diff spaces-compacted-expect out-diff-files-compacted && 359 - git checkout -f master 360 ' 361 362 test_expect_success 'diff-files: --no-indent-heuristic overrides config' ' ··· 365 git -c diff.indentHeuristic=true diff-files --no-indent-heuristic -p spaces.txt >out-diff-files-raw4 && 366 grep -v index out-diff-files-raw4 >out-diff-files && 367 compare_diff spaces-expect out-diff-files && 368 - git checkout -f master 369 ' 370 371 test_done
··· 3 test_description='Test diff indent heuristic. 4 5 ' 6 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 7 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 8 9 . ./test-lib.sh ··· 269 git reset --soft HEAD~ && 270 git diff-index --indent-heuristic -p old -- spaces.txt >out-diff-index-compacted && 271 compare_diff spaces-compacted-expect out-diff-index-compacted && 272 + git checkout -f main 273 ' 274 275 test_expect_success 'diff-index: nice spaces with diff.indentHeuristic=true' ' ··· 277 git reset --soft HEAD~ && 278 git -c diff.indentHeuristic=true diff-index -p old -- spaces.txt >out-diff-index-compacted2 && 279 compare_diff spaces-compacted-expect out-diff-index-compacted2 && 280 + git checkout -f main 281 ' 282 283 test_expect_success 'diff-index: ugly spaces with --no-indent-heuristic' ' ··· 285 git reset --soft HEAD~ && 286 git diff-index --no-indent-heuristic -p old -- spaces.txt >out-diff-index && 287 compare_diff spaces-expect out-diff-index && 288 + git checkout -f main 289 ' 290 291 test_expect_success 'diff-index: ugly spaces with diff.indentHeuristic=false' ' ··· 293 git reset --soft HEAD~ && 294 git -c diff.indentHeuristic=false diff-index -p old -- spaces.txt >out-diff-index2 && 295 compare_diff spaces-expect out-diff-index2 && 296 + git checkout -f main 297 ' 298 299 test_expect_success 'diff-index: --indent-heuristic overrides config' ' ··· 301 git reset --soft HEAD~ && 302 git -c diff.indentHeuristic=false diff-index --indent-heuristic -p old -- spaces.txt >out-diff-index-compacted3 && 303 compare_diff spaces-compacted-expect out-diff-index-compacted3 && 304 + git checkout -f main 305 ' 306 307 test_expect_success 'diff-index: --no-indent-heuristic overrides config' ' ··· 309 git reset --soft HEAD~ && 310 git -c diff.indentHeuristic=true diff-index --no-indent-heuristic -p old -- spaces.txt >out-diff-index3 && 311 compare_diff spaces-expect out-diff-index3 && 312 + git checkout -f main 313 ' 314 315 # --- diff-files tests ---------------------------------------------------- ··· 320 git diff-files --indent-heuristic -p spaces.txt >out-diff-files-raw && 321 grep -v index out-diff-files-raw >out-diff-files-compacted && 322 compare_diff spaces-compacted-expect out-diff-files-compacted && 323 + git checkout -f main 324 ' 325 326 test_expect_success 'diff-files: nice spaces with diff.indentHeuristic=true' ' ··· 329 git -c diff.indentHeuristic=true diff-files -p spaces.txt >out-diff-files-raw2 && 330 grep -v index out-diff-files-raw2 >out-diff-files-compacted2 && 331 compare_diff spaces-compacted-expect out-diff-files-compacted2 && 332 + git checkout -f main 333 ' 334 335 test_expect_success 'diff-files: ugly spaces with --no-indent-heuristic' ' ··· 338 git diff-files --no-indent-heuristic -p spaces.txt >out-diff-files-raw && 339 grep -v index out-diff-files-raw >out-diff-files && 340 compare_diff spaces-expect out-diff-files && 341 + git checkout -f main 342 ' 343 344 test_expect_success 'diff-files: ugly spaces with diff.indentHeuristic=false' ' ··· 347 git -c diff.indentHeuristic=false diff-files -p spaces.txt >out-diff-files-raw2 && 348 grep -v index out-diff-files-raw2 >out-diff-files && 349 compare_diff spaces-expect out-diff-files && 350 + git checkout -f main 351 ' 352 353 test_expect_success 'diff-files: --indent-heuristic overrides config' ' ··· 356 git -c diff.indentHeuristic=false diff-files --indent-heuristic -p spaces.txt >out-diff-files-raw3 && 357 grep -v index out-diff-files-raw3 >out-diff-files-compacted && 358 compare_diff spaces-compacted-expect out-diff-files-compacted && 359 + git checkout -f main 360 ' 361 362 test_expect_success 'diff-files: --no-indent-heuristic overrides config' ' ··· 365 git -c diff.indentHeuristic=true diff-files --no-indent-heuristic -p spaces.txt >out-diff-files-raw4 && 366 grep -v index out-diff-files-raw4 >out-diff-files && 367 compare_diff spaces-expect out-diff-files && 368 + git checkout -f main 369 ' 370 371 test_done
+2 -2
t/t4066-diff-emit-delay.sh
··· 1 #!/bin/sh 2 3 test_description='test combined/stat/moved interaction' 4 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh ··· 16 test_commit B && 17 git checkout -b side HEAD^ && 18 test_commit C && 19 - git merge -m M master && 20 test_commit D 21 ' 22
··· 1 #!/bin/sh 2 3 test_description='test combined/stat/moved interaction' 4 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh ··· 16 test_commit B && 17 git checkout -b side HEAD^ && 18 test_commit C && 19 + git merge -m M main && 20 test_commit D 21 ' 22
+25 -25
t/t4068-diff-symmetric-merge-base.sh
··· 2 3 test_description='behavior of diff with symmetric-diff setups and --merge-base' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh 9 10 # build these situations: 11 # - normal merge with one merge base (br1...b2r); 12 - # - criss-cross merge ie 2 merge bases (br1...master); 13 - # - disjoint subgraph (orphan branch, br3...master). 14 # 15 - # B---E <-- master 16 # / \ / 17 # A X 18 # \ / \ ··· 35 git add c && 36 git commit -m C && 37 git tag commit-C && 38 - git merge -m D master && 39 git tag commit-D && 40 - git checkout master && 41 git merge -m E commit-C && 42 git checkout -b br2 commit-C && 43 echo f >f && ··· 61 # It should have one of those two, which comes out 62 # to seven lines. 63 test_expect_success 'diff with two merge bases' ' 64 - git diff br1...master >tmp 2>err && 65 test_line_count = 7 tmp && 66 test_line_count = 1 err 67 ' ··· 72 ' 73 74 test_expect_success 'diff with too many symmetric differences' ' 75 - test_must_fail git diff br1...master br2...br3 2>err && 76 test_i18ngrep "usage" err 77 ' 78 79 test_expect_success 'diff with symmetric difference and extraneous arg' ' 80 - test_must_fail git diff master br1...master 2>err && 81 test_i18ngrep "usage" err 82 ' 83 84 test_expect_success 'diff with two ranges' ' 85 - test_must_fail git diff master br1..master br2..br3 2>err && 86 test_i18ngrep "usage" err 87 ' 88 89 test_expect_success 'diff with ranges and extra arg' ' 90 - test_must_fail git diff master br1..master commit-D 2>err && 91 test_i18ngrep "usage" err 92 ' 93 ··· 96 ' 97 98 test_expect_success 'diff --merge-base with three commits' ' 99 - test_must_fail git diff --merge-base br1 br2 master 2>err && 100 test_i18ngrep "usage" err 101 ' 102 103 for cmd in diff-index diff 104 do 105 test_expect_success "$cmd --merge-base with one commit" ' 106 - git checkout master && 107 git $cmd commit-C >expect && 108 git $cmd --merge-base br2 >actual && 109 test_cmp expect actual 110 ' 111 112 test_expect_success "$cmd --merge-base with one commit and unstaged changes" ' 113 - git checkout master && 114 test_when_finished git reset --hard && 115 echo unstaged >>c && 116 git $cmd commit-C >expect && ··· 119 ' 120 121 test_expect_success "$cmd --merge-base with one commit and staged and unstaged changes" ' 122 - git checkout master && 123 test_when_finished git reset --hard && 124 echo staged >>c && 125 git add c && ··· 130 ' 131 132 test_expect_success "$cmd --merge-base --cached with one commit and staged and unstaged changes" ' 133 - git checkout master && 134 test_when_finished git reset --hard && 135 echo staged >>c && 136 git add c && ··· 141 ' 142 143 test_expect_success "$cmd --merge-base with non-commit" ' 144 - git checkout master && 145 - test_must_fail git $cmd --merge-base master^{tree} 2>err && 146 test_i18ngrep "fatal: --merge-base only works with commits" err 147 ' 148 149 test_expect_success "$cmd --merge-base with no merge bases and one commit" ' 150 - git checkout master && 151 test_must_fail git $cmd --merge-base br3 2>err && 152 test_i18ngrep "fatal: no merge base found" err 153 ' 154 155 test_expect_success "$cmd --merge-base with multiple merge bases and one commit" ' 156 - git checkout master && 157 test_must_fail git $cmd --merge-base br1 2>err && 158 test_i18ngrep "fatal: multiple merge bases found" err 159 ' ··· 162 for cmd in diff-tree diff 163 do 164 test_expect_success "$cmd --merge-base with two commits" ' 165 - git $cmd commit-C master >expect && 166 - git $cmd --merge-base br2 master >actual && 167 test_cmp expect actual 168 ' 169 170 test_expect_success "$cmd --merge-base commit and non-commit" ' 171 - test_must_fail git $cmd --merge-base br2 master^{tree} 2>err && 172 test_i18ngrep "fatal: --merge-base only works with commits" err 173 ' 174 ··· 178 ' 179 180 test_expect_success "$cmd --merge-base with multiple merge bases and two commits" ' 181 - test_must_fail git $cmd --merge-base master br1 2>err && 182 test_i18ngrep "fatal: multiple merge bases found" err 183 ' 184 done 185 186 test_expect_success 'diff-tree --merge-base with one commit' ' 187 - test_must_fail git diff-tree --merge-base master 2>err && 188 test_i18ngrep "fatal: --merge-base only works with two commits" err 189 ' 190
··· 2 3 test_description='behavior of diff with symmetric-diff setups and --merge-base' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh 9 10 # build these situations: 11 # - normal merge with one merge base (br1...b2r); 12 + # - criss-cross merge ie 2 merge bases (br1...main); 13 + # - disjoint subgraph (orphan branch, br3...main). 14 # 15 + # B---E <-- main 16 # / \ / 17 # A X 18 # \ / \ ··· 35 git add c && 36 git commit -m C && 37 git tag commit-C && 38 + git merge -m D main && 39 git tag commit-D && 40 + git checkout main && 41 git merge -m E commit-C && 42 git checkout -b br2 commit-C && 43 echo f >f && ··· 61 # It should have one of those two, which comes out 62 # to seven lines. 63 test_expect_success 'diff with two merge bases' ' 64 + git diff br1...main >tmp 2>err && 65 test_line_count = 7 tmp && 66 test_line_count = 1 err 67 ' ··· 72 ' 73 74 test_expect_success 'diff with too many symmetric differences' ' 75 + test_must_fail git diff br1...main br2...br3 2>err && 76 test_i18ngrep "usage" err 77 ' 78 79 test_expect_success 'diff with symmetric difference and extraneous arg' ' 80 + test_must_fail git diff main br1...main 2>err && 81 test_i18ngrep "usage" err 82 ' 83 84 test_expect_success 'diff with two ranges' ' 85 + test_must_fail git diff main br1..main br2..br3 2>err && 86 test_i18ngrep "usage" err 87 ' 88 89 test_expect_success 'diff with ranges and extra arg' ' 90 + test_must_fail git diff main br1..main commit-D 2>err && 91 test_i18ngrep "usage" err 92 ' 93 ··· 96 ' 97 98 test_expect_success 'diff --merge-base with three commits' ' 99 + test_must_fail git diff --merge-base br1 br2 main 2>err && 100 test_i18ngrep "usage" err 101 ' 102 103 for cmd in diff-index diff 104 do 105 test_expect_success "$cmd --merge-base with one commit" ' 106 + git checkout main && 107 git $cmd commit-C >expect && 108 git $cmd --merge-base br2 >actual && 109 test_cmp expect actual 110 ' 111 112 test_expect_success "$cmd --merge-base with one commit and unstaged changes" ' 113 + git checkout main && 114 test_when_finished git reset --hard && 115 echo unstaged >>c && 116 git $cmd commit-C >expect && ··· 119 ' 120 121 test_expect_success "$cmd --merge-base with one commit and staged and unstaged changes" ' 122 + git checkout main && 123 test_when_finished git reset --hard && 124 echo staged >>c && 125 git add c && ··· 130 ' 131 132 test_expect_success "$cmd --merge-base --cached with one commit and staged and unstaged changes" ' 133 + git checkout main && 134 test_when_finished git reset --hard && 135 echo staged >>c && 136 git add c && ··· 141 ' 142 143 test_expect_success "$cmd --merge-base with non-commit" ' 144 + git checkout main && 145 + test_must_fail git $cmd --merge-base main^{tree} 2>err && 146 test_i18ngrep "fatal: --merge-base only works with commits" err 147 ' 148 149 test_expect_success "$cmd --merge-base with no merge bases and one commit" ' 150 + git checkout main && 151 test_must_fail git $cmd --merge-base br3 2>err && 152 test_i18ngrep "fatal: no merge base found" err 153 ' 154 155 test_expect_success "$cmd --merge-base with multiple merge bases and one commit" ' 156 + git checkout main && 157 test_must_fail git $cmd --merge-base br1 2>err && 158 test_i18ngrep "fatal: multiple merge bases found" err 159 ' ··· 162 for cmd in diff-tree diff 163 do 164 test_expect_success "$cmd --merge-base with two commits" ' 165 + git $cmd commit-C main >expect && 166 + git $cmd --merge-base br2 main >actual && 167 test_cmp expect actual 168 ' 169 170 test_expect_success "$cmd --merge-base commit and non-commit" ' 171 + test_must_fail git $cmd --merge-base br2 main^{tree} 2>err && 172 test_i18ngrep "fatal: --merge-base only works with commits" err 173 ' 174 ··· 178 ' 179 180 test_expect_success "$cmd --merge-base with multiple merge bases and two commits" ' 181 + test_must_fail git $cmd --merge-base main br1 2>err && 182 test_i18ngrep "fatal: multiple merge bases found" err 183 ' 184 done 185 186 test_expect_success 'diff-tree --merge-base with one commit' ' 187 + test_must_fail git diff-tree --merge-base main 2>err && 188 test_i18ngrep "fatal: --merge-base only works with two commits" err 189 ' 190
+19 -19
t/t4103-apply-binary.sh
··· 6 test_description='git apply handling binary patches 7 8 ' 9 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 10 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 11 12 . ./test-lib.sh ··· 34 git update-index --add --remove file1 file2 file3 file4 && 35 git commit -m "Second Version" && 36 37 - git diff-tree -p master binary >B.diff && 38 - git diff-tree -p -C master binary >C.diff && 39 40 - git diff-tree -p --binary master binary >BF.diff && 41 - git diff-tree -p --binary -C master binary >CF.diff && 42 43 - git diff-tree -p --full-index master binary >B-index.diff && 44 - git diff-tree -p -C --full-index master binary >C-index.diff && 45 46 - git diff-tree -p --binary --no-prefix master binary -- file3 >B0.diff && 47 48 git init other-repo && 49 ( 50 cd other-repo && 51 - git fetch .. master && 52 git reset --hard FETCH_HEAD 53 ) 54 ' 55 56 test_expect_success 'stat binary diff -- should not fail.' \ 57 - 'git checkout master && 58 git apply --stat --summary B.diff' 59 60 test_expect_success 'stat binary -p0 diff -- should not fail.' ' 61 - git checkout master && 62 git apply --stat -p0 B0.diff 63 ' 64 65 test_expect_success 'stat binary diff (copy) -- should not fail.' \ 66 - 'git checkout master && 67 git apply --stat --summary C.diff' 68 69 test_expect_success 'check binary diff -- should fail.' \ 70 - 'git checkout master && 71 test_must_fail git apply --check B.diff' 72 73 test_expect_success 'check binary diff (copy) -- should fail.' \ 74 - 'git checkout master && 75 test_must_fail git apply --check C.diff' 76 77 test_expect_success \ 78 'check incomplete binary diff with replacement -- should fail.' ' 79 - git checkout master && 80 test_must_fail git apply --check --allow-binary-replacement B.diff 81 ' 82 83 test_expect_success \ 84 'check incomplete binary diff with replacement (copy) -- should fail.' ' 85 - git checkout master && 86 test_must_fail git apply --check --allow-binary-replacement C.diff 87 ' 88 89 test_expect_success 'check binary diff with replacement.' \ 90 - 'git checkout master && 91 git apply --check --allow-binary-replacement BF.diff' 92 93 test_expect_success 'check binary diff with replacement (copy).' \ 94 - 'git checkout master && 95 git apply --check --allow-binary-replacement CF.diff' 96 97 # Now we start applying them. ··· 99 do_reset () { 100 rm -f file? && 101 git reset --hard && 102 - git checkout -f master 103 } 104 105 test_expect_success 'apply binary diff -- should fail.' \
··· 6 test_description='git apply handling binary patches 7 8 ' 9 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 10 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 11 12 . ./test-lib.sh ··· 34 git update-index --add --remove file1 file2 file3 file4 && 35 git commit -m "Second Version" && 36 37 + git diff-tree -p main binary >B.diff && 38 + git diff-tree -p -C main binary >C.diff && 39 40 + git diff-tree -p --binary main binary >BF.diff && 41 + git diff-tree -p --binary -C main binary >CF.diff && 42 43 + git diff-tree -p --full-index main binary >B-index.diff && 44 + git diff-tree -p -C --full-index main binary >C-index.diff && 45 46 + git diff-tree -p --binary --no-prefix main binary -- file3 >B0.diff && 47 48 git init other-repo && 49 ( 50 cd other-repo && 51 + git fetch .. main && 52 git reset --hard FETCH_HEAD 53 ) 54 ' 55 56 test_expect_success 'stat binary diff -- should not fail.' \ 57 + 'git checkout main && 58 git apply --stat --summary B.diff' 59 60 test_expect_success 'stat binary -p0 diff -- should not fail.' ' 61 + git checkout main && 62 git apply --stat -p0 B0.diff 63 ' 64 65 test_expect_success 'stat binary diff (copy) -- should not fail.' \ 66 + 'git checkout main && 67 git apply --stat --summary C.diff' 68 69 test_expect_success 'check binary diff -- should fail.' \ 70 + 'git checkout main && 71 test_must_fail git apply --check B.diff' 72 73 test_expect_success 'check binary diff (copy) -- should fail.' \ 74 + 'git checkout main && 75 test_must_fail git apply --check C.diff' 76 77 test_expect_success \ 78 'check incomplete binary diff with replacement -- should fail.' ' 79 + git checkout main && 80 test_must_fail git apply --check --allow-binary-replacement B.diff 81 ' 82 83 test_expect_success \ 84 'check incomplete binary diff with replacement (copy) -- should fail.' ' 85 + git checkout main && 86 test_must_fail git apply --check --allow-binary-replacement C.diff 87 ' 88 89 test_expect_success 'check binary diff with replacement.' \ 90 + 'git checkout main && 91 git apply --check --allow-binary-replacement BF.diff' 92 93 test_expect_success 'check binary diff with replacement (copy).' \ 94 + 'git checkout main && 95 git apply --check --allow-binary-replacement CF.diff' 96 97 # Now we start applying them. ··· 99 do_reset () { 100 rm -f file? && 101 git reset --hard && 102 + git checkout -f main 103 } 104 105 test_expect_success 'apply binary diff -- should fail.' \
+8 -8
t/t4108-apply-threeway.sh
··· 2 3 test_description='git apply --3way' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 27 test_tick && 28 test_write_lines 1 two 3 4 5 six 7 >one && 29 test_write_lines 1 two 3 4 5 6 7 >two && 30 - git commit -a -m master && 31 32 git checkout side && 33 test_write_lines 1 2 3 4 five 6 7 >one && 34 test_write_lines 1 2 3 4 five 6 7 >two && 35 git commit -a -m side && 36 37 - git checkout master 38 ' 39 40 test_expect_success 'apply without --3way' ' ··· 42 43 # should fail to apply 44 git reset --hard && 45 - git checkout master^0 && 46 test_must_fail git apply --index P.diff && 47 # should leave things intact 48 git diff-files --exit-code && ··· 55 56 # The corresponding conflicted merge 57 git reset --hard && 58 - git checkout master^0 && 59 test_must_fail git merge --no-commit side && 60 git ls-files -s >expect.ls && 61 print_sanitized_conflicted_diff >expect.diff && 62 63 # should fail to apply 64 git reset --hard && 65 - git checkout master^0 && 66 test_must_fail git apply --index --3way P.diff && 67 git ls-files -s >actual.ls && 68 print_sanitized_conflicted_diff >actual.diff && ··· 89 90 # The corresponding conflicted merge 91 git reset --hard && 92 - git checkout master^0 && 93 test_must_fail git merge --no-commit side && 94 95 # Manually resolve and record the resolution ··· 99 100 # should fail to apply 101 git reset --hard && 102 - git checkout master^0 && 103 test_must_fail git apply --index --3way P.diff && 104 105 # but rerere should have replayed the recorded resolution
··· 2 3 test_description='git apply --3way' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 27 test_tick && 28 test_write_lines 1 two 3 4 5 six 7 >one && 29 test_write_lines 1 two 3 4 5 6 7 >two && 30 + git commit -a -m main && 31 32 git checkout side && 33 test_write_lines 1 2 3 4 five 6 7 >one && 34 test_write_lines 1 2 3 4 five 6 7 >two && 35 git commit -a -m side && 36 37 + git checkout main 38 ' 39 40 test_expect_success 'apply without --3way' ' ··· 42 43 # should fail to apply 44 git reset --hard && 45 + git checkout main^0 && 46 test_must_fail git apply --index P.diff && 47 # should leave things intact 48 git diff-files --exit-code && ··· 55 56 # The corresponding conflicted merge 57 git reset --hard && 58 + git checkout main^0 && 59 test_must_fail git merge --no-commit side && 60 git ls-files -s >expect.ls && 61 print_sanitized_conflicted_diff >expect.diff && 62 63 # should fail to apply 64 git reset --hard && 65 + git checkout main^0 && 66 test_must_fail git apply --index --3way P.diff && 67 git ls-files -s >actual.ls && 68 print_sanitized_conflicted_diff >actual.diff && ··· 89 90 # The corresponding conflicted merge 91 git reset --hard && 92 + git checkout main^0 && 93 test_must_fail git merge --no-commit side && 94 95 # Manually resolve and record the resolution ··· 99 100 # should fail to apply 101 git reset --hard && 102 + git checkout main^0 && 103 test_must_fail git apply --index --3way P.diff && 104 105 # but rerere should have replayed the recorded resolution
+2 -2
t/t4121-apply-diffs.sh
··· 1 #!/bin/sh 2 3 test_description='git apply for contextually independent diffs' 4 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh ··· 26 git commit -a -q -m 2 && 27 echo 9 >>file && 28 git commit -a -q -m 3 && 29 - git checkout master' 30 31 test_expect_success \ 32 'check if contextually independent diffs for the same file apply' \
··· 1 #!/bin/sh 2 3 test_description='git apply for contextually independent diffs' 4 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh ··· 26 git commit -a -q -m 2 && 27 echo 9 >>file && 28 git commit -a -q -m 3 && 29 + git checkout main' 30 31 test_expect_success \ 32 'check if contextually independent diffs for the same file apply' \
+14 -14
t/t4150-am.sh
··· 2 3 test_description='git am running' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 182 test_tick && 183 git commit -m "added another file" && 184 185 - git format-patch --stdout master >lorem-move.patch && 186 - git format-patch --no-prefix --stdout master >lorem-zero.patch && 187 188 git checkout -b rename && 189 git mv file renamed && ··· 456 git checkout first && 457 git am patch2 && 458 test_path_is_missing .git/rebase-apply && 459 - test "$(git rev-parse master^^)" = "$(git rev-parse HEAD^^)" && 460 - git diff --exit-code master..HEAD && 461 - git diff --exit-code master^..HEAD^ && 462 - compare author master HEAD && 463 - compare author master^ HEAD^ && 464 test "$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" = \ 465 "$(git log -1 --pretty=format:"%cn <%ce>" HEAD)" 466 ' ··· 762 git checkout first && 763 cat pine patch1 | git am && 764 test_path_is_missing .git/rebase-apply && 765 - git diff --exit-code master^..HEAD 766 ' 767 768 test_expect_success 'am fails on mail without patch' ' ··· 1115 test_commit sixth && 1116 1117 git checkout test && 1118 - git format-patch --stdout master..HEAD >patches && 1119 - git reset --hard master && 1120 git am patches && 1121 grep "smudged" a.txt && 1122 1123 git checkout removal && 1124 git reset --hard && 1125 - git format-patch --stdout master..HEAD >patches && 1126 - git reset --hard master && 1127 git am patches && 1128 grep "clean" a.txt && 1129 1130 git checkout conflict && 1131 git reset --hard && 1132 - git format-patch --stdout master..HEAD >patches && 1133 git reset --hard fourth && 1134 test_must_fail git am -3 patches && 1135 grep "<<<<<<<<<<" a.txt
··· 2 3 test_description='git am running' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 182 test_tick && 183 git commit -m "added another file" && 184 185 + git format-patch --stdout main >lorem-move.patch && 186 + git format-patch --no-prefix --stdout main >lorem-zero.patch && 187 188 git checkout -b rename && 189 git mv file renamed && ··· 456 git checkout first && 457 git am patch2 && 458 test_path_is_missing .git/rebase-apply && 459 + test "$(git rev-parse main^^)" = "$(git rev-parse HEAD^^)" && 460 + git diff --exit-code main..HEAD && 461 + git diff --exit-code main^..HEAD^ && 462 + compare author main HEAD && 463 + compare author main^ HEAD^ && 464 test "$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" = \ 465 "$(git log -1 --pretty=format:"%cn <%ce>" HEAD)" 466 ' ··· 762 git checkout first && 763 cat pine patch1 | git am && 764 test_path_is_missing .git/rebase-apply && 765 + git diff --exit-code main^..HEAD 766 ' 767 768 test_expect_success 'am fails on mail without patch' ' ··· 1115 test_commit sixth && 1116 1117 git checkout test && 1118 + git format-patch --stdout main..HEAD >patches && 1119 + git reset --hard main && 1120 git am patches && 1121 grep "smudged" a.txt && 1122 1123 git checkout removal && 1124 git reset --hard && 1125 + git format-patch --stdout main..HEAD >patches && 1126 + git reset --hard main && 1127 git am patches && 1128 grep "clean" a.txt && 1129 1130 git checkout conflict && 1131 git reset --hard && 1132 + git format-patch --stdout main..HEAD >patches && 1133 git reset --hard fourth && 1134 test_must_fail git am -3 patches && 1135 grep "<<<<<<<<<<" a.txt
+11 -11
t/t4200-rerere.sh
··· 8 ! [fifth] version1 9 ! [first] first 10 ! [fourth] version1 11 - ! [master] initial 12 ! [second] prefer first over second 13 ! [third] version2 14 ------ ··· 19 - [second] prefer first over second 20 + + [first] first 21 + [second^] second 22 - ++++++ [master] initial 23 ' 24 25 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 26 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 27 28 . ./test-lib.sh ··· 60 test_tick && 61 git commit -q -a -m first && 62 63 - git checkout -b second master && 64 git show first:a1 | 65 sed -e "s/To die, t/To die! T/" -e "s/Some title/Some Title/" >a1 && 66 echo "* END *" >>a1 && ··· 171 172 oldmtimepost=$(test-tool chmtime --get -60 $rr/postimage) && 173 174 - git checkout -b third master && 175 git show second^:a1 | sed "s/To die: t/To die! T/" >a1 && 176 git commit -q -a -m third && 177 ··· 583 test_expect_success 'rerere with unexpected conflict markers does not crash' ' 584 git reset --hard && 585 586 - git checkout -b branch-1 master && 587 echo "bar" >test && 588 git add test && 589 git commit -q -m two && 590 591 git reset --hard && 592 - git checkout -b branch-2 master && 593 echo "foo" >test && 594 git add test && 595 git commit -q -a -m one && ··· 604 test_expect_success 'rerere with inner conflict markers' ' 605 git reset --hard && 606 607 - git checkout -b A master && 608 echo "bar" >test && 609 git add test && 610 git commit -q -m two && ··· 613 git commit -q -m three && 614 615 git reset --hard && 616 - git checkout -b B master && 617 echo "foo" >test && 618 git add test && 619 git commit -q -a -m one && ··· 654 git add original && 655 git commit -m original && 656 657 - git checkout -b A master && 658 git mv original A && 659 git commit -m "rename to A" && 660 661 - git checkout -b B master && 662 git mv original B && 663 git commit -m "rename to B" 664 )
··· 8 ! [fifth] version1 9 ! [first] first 10 ! [fourth] version1 11 + ! [main] initial 12 ! [second] prefer first over second 13 ! [third] version2 14 ------ ··· 19 - [second] prefer first over second 20 + + [first] first 21 + [second^] second 22 + ++++++ [main] initial 23 ' 24 25 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 26 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 27 28 . ./test-lib.sh ··· 60 test_tick && 61 git commit -q -a -m first && 62 63 + git checkout -b second main && 64 git show first:a1 | 65 sed -e "s/To die, t/To die! T/" -e "s/Some title/Some Title/" >a1 && 66 echo "* END *" >>a1 && ··· 171 172 oldmtimepost=$(test-tool chmtime --get -60 $rr/postimage) && 173 174 + git checkout -b third main && 175 git show second^:a1 | sed "s/To die: t/To die! T/" >a1 && 176 git commit -q -a -m third && 177 ··· 583 test_expect_success 'rerere with unexpected conflict markers does not crash' ' 584 git reset --hard && 585 586 + git checkout -b branch-1 main && 587 echo "bar" >test && 588 git add test && 589 git commit -q -m two && 590 591 git reset --hard && 592 + git checkout -b branch-2 main && 593 echo "foo" >test && 594 git add test && 595 git commit -q -a -m one && ··· 604 test_expect_success 'rerere with inner conflict markers' ' 605 git reset --hard && 606 607 + git checkout -b A main && 608 echo "bar" >test && 609 git add test && 610 git commit -q -m two && ··· 613 git commit -q -m three && 614 615 git reset --hard && 616 + git checkout -b B main && 617 echo "foo" >test && 618 git add test && 619 git commit -q -a -m one && ··· 654 git add original && 655 git commit -m original && 656 657 + git checkout -b A main && 658 git mv original A && 659 git commit -m "rename to A" && 660 661 + git checkout -b B main && 662 git mv original B && 663 git commit -m "rename to B" 664 )
+2 -2
t/t4201-shortlog.sh
··· 6 test_description='git shortlog 7 ' 8 9 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 10 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 11 12 . ./test-lib.sh ··· 194 ' 195 196 test_expect_success 'shortlog with --output=<file>' ' 197 - git shortlog --output=shortlog -1 master >output && 198 test_must_be_empty output && 199 test_line_count = 3 shortlog 200 '
··· 6 test_description='git shortlog 7 ' 8 9 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 10 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 11 12 . ./test-lib.sh ··· 194 ' 195 196 test_expect_success 'shortlog with --output=<file>' ' 197 + git shortlog --output=shortlog -1 main >output && 198 test_must_be_empty output && 199 test_line_count = 3 shortlog 200 '
+54 -54
t/t4202-log.sh
··· 2 3 test_description='git log' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 481 git checkout -b side HEAD~4 && 482 test_commit side-1 1 1 && 483 test_commit side-2 2 2 && 484 - git checkout master && 485 git merge side 486 ' 487 ··· 544 ' 545 546 test_expect_success 'log --raw --graph -m with merge' ' 547 - git log --raw --graph --oneline -m master | head -n 500 >actual && 548 grep "initial" actual 549 ' 550 551 test_expect_success 'diff-tree --graph' ' 552 - git diff-tree --graph master^ | head -n 500 >actual && 553 grep "one" actual 554 ' 555 556 cat > expect <<\EOF 557 - * commit master 558 |\ Merge: A B 559 | | Author: A U Thor <author@example.com> 560 | | ··· 570 | | 571 | | side-1 572 | | 573 - * | commit master~1 574 | | Author: A U Thor <author@example.com> 575 | | 576 | | Second 577 | | 578 - * | commit master~2 579 | | Author: A U Thor <author@example.com> 580 | | 581 | | sixth 582 | | 583 - * | commit master~3 584 | | Author: A U Thor <author@example.com> 585 | | 586 | | fifth 587 | | 588 - * | commit master~4 589 |/ Author: A U Thor <author@example.com> 590 | 591 | fourth ··· 616 test_expect_success 'set up more tangled history' ' 617 git checkout -b tangle HEAD~6 && 618 test_commit tangle-a tangle-a a && 619 - git merge master~3 && 620 git merge side~1 && 621 - git checkout master && 622 git merge tangle && 623 git checkout -b reach && 624 test_commit reach && 625 - git checkout master && 626 git checkout -b octopus-a && 627 test_commit octopus-a && 628 - git checkout master && 629 git checkout -b octopus-b && 630 test_commit octopus-b && 631 - git checkout master && 632 test_commit seventh && 633 git merge octopus-a octopus-b && 634 git merge reach ··· 653 |\ 654 | * Merge branch 'side' (early part) into tangle 655 | |\ 656 - | * \ Merge branch 'master' (early part) into tangle 657 | |\ \ 658 | * | | tangle-a 659 * | | | Merge branch 'side' ··· 797 798 test_expect_success 'decorate-refs-exclude with glob' ' 799 cat >expect.decorate <<-\EOF && 800 - Merge-tag-reach (HEAD -> master) 801 Merge-tags-octopus-a-and-octopus-b 802 seventh (tag: seventh) 803 octopus-b (tag: octopus-b) ··· 814 815 test_expect_success 'decorate-refs-exclude without globs' ' 816 cat >expect.decorate <<-\EOF && 817 - Merge-tag-reach (HEAD -> master) 818 Merge-tags-octopus-a-and-octopus-b 819 seventh (tag: seventh) 820 octopus-b (tag: octopus-b, octopus-b) ··· 831 832 test_expect_success 'multiple decorate-refs-exclude' ' 833 cat >expect.decorate <<-\EOF && 834 - Merge-tag-reach (HEAD -> master) 835 Merge-tags-octopus-a-and-octopus-b 836 seventh (tag: seventh) 837 octopus-b (tag: octopus-b) ··· 854 855 test_expect_success 'decorate-refs and decorate-refs-exclude' ' 856 cat >expect.no-decorate <<-\EOF && 857 - Merge-tag-reach (master) 858 Merge-tags-octopus-a-and-octopus-b 859 seventh 860 octopus-b ··· 869 870 test_expect_success 'deocrate-refs and log.excludeDecoration' ' 871 cat >expect.decorate <<-\EOF && 872 - Merge-tag-reach (master) 873 Merge-tags-octopus-a-and-octopus-b 874 seventh 875 octopus-b (octopus-b) ··· 884 885 test_expect_success 'decorate-refs-exclude and simplify-by-decoration' ' 886 cat >expect.decorate <<-\EOF && 887 - Merge-tag-reach (HEAD -> master) 888 reach (tag: reach, reach) 889 seventh (tag: seventh) 890 Merge-branch-tangle ··· 1083 | |\ \ Merge: MERGE_PARENTS 1084 | | | | Author: A U Thor <author@example.com> 1085 | | | | 1086 - | | | | Merge branch 'master' (early part) into tangle 1087 | | | | 1088 | * | | commit COMMIT_OBJECT_NAME 1089 | | | | Author: A U Thor <author@example.com> ··· 1358 *** | |\ \ Merge: MERGE_PARENTS 1359 *** | | | | Author: A U Thor <author@example.com> 1360 *** | | | | 1361 - *** | | | | Merge branch 'master' (early part) into tangle 1362 *** | | | | 1363 *** | * | | commit COMMIT_OBJECT_NAME 1364 *** | | | | Author: A U Thor <author@example.com> ··· 1591 ' 1592 1593 test_expect_success GPG 'setup signed branch' ' 1594 - test_when_finished "git reset --hard && git checkout master" && 1595 - git checkout -b signed master && 1596 echo foo >foo && 1597 git add foo && 1598 git commit -S -m signed_commit 1599 ' 1600 1601 test_expect_success GPG 'setup signed branch with subkey' ' 1602 - test_when_finished "git reset --hard && git checkout master" && 1603 - git checkout -b signed-subkey master && 1604 echo foo >foo && 1605 git add foo && 1606 git commit -SB7227189 -m signed_commit 1607 ' 1608 1609 test_expect_success GPGSM 'setup signed branch x509' ' 1610 - test_when_finished "git reset --hard && git checkout master" && 1611 - git checkout -b signed-x509 master && 1612 echo foo >foo && 1613 git add foo && 1614 test_config gpg.format x509 && ··· 1641 ' 1642 1643 test_expect_success GPG 'log --graph --show-signature for merged tag' ' 1644 - test_when_finished "git reset --hard && git checkout master" && 1645 - git checkout -b plain master && 1646 echo aaa >bar && 1647 git add bar && 1648 git commit -m bar_commit && 1649 - git checkout -b tagged master && 1650 echo bbb >baz && 1651 git add baz && 1652 git commit -m baz_commit && ··· 1660 ' 1661 1662 test_expect_success GPG 'log --graph --show-signature for merged tag in shallow clone' ' 1663 - test_when_finished "git reset --hard && git checkout master" && 1664 - git checkout -b plain-shallow master && 1665 echo aaa >bar && 1666 git add bar && 1667 git commit -m bar_commit && 1668 - git checkout --detach master && 1669 echo bbb >baz && 1670 git add baz && 1671 git commit -m baz_commit && ··· 1680 ' 1681 1682 test_expect_success GPG 'log --graph --show-signature for merged tag with missing key' ' 1683 - test_when_finished "git reset --hard && git checkout master" && 1684 - git checkout -b plain-nokey master && 1685 echo aaa >bar && 1686 git add bar && 1687 git commit -m bar_commit && 1688 - git checkout -b tagged-nokey master && 1689 echo bbb >baz && 1690 git add baz && 1691 git commit -m baz_commit && ··· 1699 ' 1700 1701 test_expect_success GPG 'log --graph --show-signature for merged tag with bad signature' ' 1702 - test_when_finished "git reset --hard && git checkout master" && 1703 - git checkout -b plain-bad master && 1704 echo aaa >bar && 1705 git add bar && 1706 git commit -m bar_commit && 1707 - git checkout -b tagged-bad master && 1708 echo bbb >baz && 1709 git add baz && 1710 git commit -m baz_commit && ··· 1721 ' 1722 1723 test_expect_success GPG 'log --show-signature for merged tag with GPG failure' ' 1724 - test_when_finished "git reset --hard && git checkout master" && 1725 - git checkout -b plain-fail master && 1726 echo aaa >bar && 1727 git add bar && 1728 git commit -m bar_commit && 1729 - git checkout -b tagged-fail master && 1730 echo bbb >baz && 1731 git add baz && 1732 git commit -m baz_commit && ··· 1740 ' 1741 1742 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' ' 1743 - test_when_finished "git reset --hard && git checkout master" && 1744 test_config gpg.format x509 && 1745 test_config user.signingkey $GIT_COMMITTER_EMAIL && 1746 - git checkout -b plain-x509 master && 1747 echo aaa >bar && 1748 git add bar && 1749 git commit -m bar_commit && 1750 - git checkout -b tagged-x509 master && 1751 echo bbb >baz && 1752 git add baz && 1753 git commit -m baz_commit && ··· 1761 ' 1762 1763 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 missing key' ' 1764 - test_when_finished "git reset --hard && git checkout master" && 1765 test_config gpg.format x509 && 1766 test_config user.signingkey $GIT_COMMITTER_EMAIL && 1767 - git checkout -b plain-x509-nokey master && 1768 echo aaa >bar && 1769 git add bar && 1770 git commit -m bar_commit && 1771 - git checkout -b tagged-x509-nokey master && 1772 echo bbb >baz && 1773 git add baz && 1774 git commit -m baz_commit && ··· 1781 ' 1782 1783 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 bad signature' ' 1784 - test_when_finished "git reset --hard && git checkout master" && 1785 test_config gpg.format x509 && 1786 test_config user.signingkey $GIT_COMMITTER_EMAIL && 1787 - git checkout -b plain-x509-bad master && 1788 echo aaa >bar && 1789 git add bar && 1790 git commit -m bar_commit && 1791 - git checkout -b tagged-x509-bad master && 1792 echo bbb >baz && 1793 git add baz && 1794 git commit -m baz_commit && ··· 1838 git init empty && 1839 test_must_fail git -C empty log 2>stderr && 1840 test_i18ngrep does.not.have.any.commits stderr && 1841 - echo 1234abcd >empty/.git/refs/heads/master && 1842 test_must_fail git -C empty log 2>stderr && 1843 test_i18ngrep broken stderr && 1844 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
··· 2 3 test_description='git log' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 481 git checkout -b side HEAD~4 && 482 test_commit side-1 1 1 && 483 test_commit side-2 2 2 && 484 + git checkout main && 485 git merge side 486 ' 487 ··· 544 ' 545 546 test_expect_success 'log --raw --graph -m with merge' ' 547 + git log --raw --graph --oneline -m main | head -n 500 >actual && 548 grep "initial" actual 549 ' 550 551 test_expect_success 'diff-tree --graph' ' 552 + git diff-tree --graph main^ | head -n 500 >actual && 553 grep "one" actual 554 ' 555 556 cat > expect <<\EOF 557 + * commit main 558 |\ Merge: A B 559 | | Author: A U Thor <author@example.com> 560 | | ··· 570 | | 571 | | side-1 572 | | 573 + * | commit main~1 574 | | Author: A U Thor <author@example.com> 575 | | 576 | | Second 577 | | 578 + * | commit main~2 579 | | Author: A U Thor <author@example.com> 580 | | 581 | | sixth 582 | | 583 + * | commit main~3 584 | | Author: A U Thor <author@example.com> 585 | | 586 | | fifth 587 | | 588 + * | commit main~4 589 |/ Author: A U Thor <author@example.com> 590 | 591 | fourth ··· 616 test_expect_success 'set up more tangled history' ' 617 git checkout -b tangle HEAD~6 && 618 test_commit tangle-a tangle-a a && 619 + git merge main~3 && 620 git merge side~1 && 621 + git checkout main && 622 git merge tangle && 623 git checkout -b reach && 624 test_commit reach && 625 + git checkout main && 626 git checkout -b octopus-a && 627 test_commit octopus-a && 628 + git checkout main && 629 git checkout -b octopus-b && 630 test_commit octopus-b && 631 + git checkout main && 632 test_commit seventh && 633 git merge octopus-a octopus-b && 634 git merge reach ··· 653 |\ 654 | * Merge branch 'side' (early part) into tangle 655 | |\ 656 + | * \ Merge branch 'main' (early part) into tangle 657 | |\ \ 658 | * | | tangle-a 659 * | | | Merge branch 'side' ··· 797 798 test_expect_success 'decorate-refs-exclude with glob' ' 799 cat >expect.decorate <<-\EOF && 800 + Merge-tag-reach (HEAD -> main) 801 Merge-tags-octopus-a-and-octopus-b 802 seventh (tag: seventh) 803 octopus-b (tag: octopus-b) ··· 814 815 test_expect_success 'decorate-refs-exclude without globs' ' 816 cat >expect.decorate <<-\EOF && 817 + Merge-tag-reach (HEAD -> main) 818 Merge-tags-octopus-a-and-octopus-b 819 seventh (tag: seventh) 820 octopus-b (tag: octopus-b, octopus-b) ··· 831 832 test_expect_success 'multiple decorate-refs-exclude' ' 833 cat >expect.decorate <<-\EOF && 834 + Merge-tag-reach (HEAD -> main) 835 Merge-tags-octopus-a-and-octopus-b 836 seventh (tag: seventh) 837 octopus-b (tag: octopus-b) ··· 854 855 test_expect_success 'decorate-refs and decorate-refs-exclude' ' 856 cat >expect.no-decorate <<-\EOF && 857 + Merge-tag-reach (main) 858 Merge-tags-octopus-a-and-octopus-b 859 seventh 860 octopus-b ··· 869 870 test_expect_success 'deocrate-refs and log.excludeDecoration' ' 871 cat >expect.decorate <<-\EOF && 872 + Merge-tag-reach (main) 873 Merge-tags-octopus-a-and-octopus-b 874 seventh 875 octopus-b (octopus-b) ··· 884 885 test_expect_success 'decorate-refs-exclude and simplify-by-decoration' ' 886 cat >expect.decorate <<-\EOF && 887 + Merge-tag-reach (HEAD -> main) 888 reach (tag: reach, reach) 889 seventh (tag: seventh) 890 Merge-branch-tangle ··· 1083 | |\ \ Merge: MERGE_PARENTS 1084 | | | | Author: A U Thor <author@example.com> 1085 | | | | 1086 + | | | | Merge branch 'main' (early part) into tangle 1087 | | | | 1088 | * | | commit COMMIT_OBJECT_NAME 1089 | | | | Author: A U Thor <author@example.com> ··· 1358 *** | |\ \ Merge: MERGE_PARENTS 1359 *** | | | | Author: A U Thor <author@example.com> 1360 *** | | | | 1361 + *** | | | | Merge branch 'main' (early part) into tangle 1362 *** | | | | 1363 *** | * | | commit COMMIT_OBJECT_NAME 1364 *** | | | | Author: A U Thor <author@example.com> ··· 1591 ' 1592 1593 test_expect_success GPG 'setup signed branch' ' 1594 + test_when_finished "git reset --hard && git checkout main" && 1595 + git checkout -b signed main && 1596 echo foo >foo && 1597 git add foo && 1598 git commit -S -m signed_commit 1599 ' 1600 1601 test_expect_success GPG 'setup signed branch with subkey' ' 1602 + test_when_finished "git reset --hard && git checkout main" && 1603 + git checkout -b signed-subkey main && 1604 echo foo >foo && 1605 git add foo && 1606 git commit -SB7227189 -m signed_commit 1607 ' 1608 1609 test_expect_success GPGSM 'setup signed branch x509' ' 1610 + test_when_finished "git reset --hard && git checkout main" && 1611 + git checkout -b signed-x509 main && 1612 echo foo >foo && 1613 git add foo && 1614 test_config gpg.format x509 && ··· 1641 ' 1642 1643 test_expect_success GPG 'log --graph --show-signature for merged tag' ' 1644 + test_when_finished "git reset --hard && git checkout main" && 1645 + git checkout -b plain main && 1646 echo aaa >bar && 1647 git add bar && 1648 git commit -m bar_commit && 1649 + git checkout -b tagged main && 1650 echo bbb >baz && 1651 git add baz && 1652 git commit -m baz_commit && ··· 1660 ' 1661 1662 test_expect_success GPG 'log --graph --show-signature for merged tag in shallow clone' ' 1663 + test_when_finished "git reset --hard && git checkout main" && 1664 + git checkout -b plain-shallow main && 1665 echo aaa >bar && 1666 git add bar && 1667 git commit -m bar_commit && 1668 + git checkout --detach main && 1669 echo bbb >baz && 1670 git add baz && 1671 git commit -m baz_commit && ··· 1680 ' 1681 1682 test_expect_success GPG 'log --graph --show-signature for merged tag with missing key' ' 1683 + test_when_finished "git reset --hard && git checkout main" && 1684 + git checkout -b plain-nokey main && 1685 echo aaa >bar && 1686 git add bar && 1687 git commit -m bar_commit && 1688 + git checkout -b tagged-nokey main && 1689 echo bbb >baz && 1690 git add baz && 1691 git commit -m baz_commit && ··· 1699 ' 1700 1701 test_expect_success GPG 'log --graph --show-signature for merged tag with bad signature' ' 1702 + test_when_finished "git reset --hard && git checkout main" && 1703 + git checkout -b plain-bad main && 1704 echo aaa >bar && 1705 git add bar && 1706 git commit -m bar_commit && 1707 + git checkout -b tagged-bad main && 1708 echo bbb >baz && 1709 git add baz && 1710 git commit -m baz_commit && ··· 1721 ' 1722 1723 test_expect_success GPG 'log --show-signature for merged tag with GPG failure' ' 1724 + test_when_finished "git reset --hard && git checkout main" && 1725 + git checkout -b plain-fail main && 1726 echo aaa >bar && 1727 git add bar && 1728 git commit -m bar_commit && 1729 + git checkout -b tagged-fail main && 1730 echo bbb >baz && 1731 git add baz && 1732 git commit -m baz_commit && ··· 1740 ' 1741 1742 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' ' 1743 + test_when_finished "git reset --hard && git checkout main" && 1744 test_config gpg.format x509 && 1745 test_config user.signingkey $GIT_COMMITTER_EMAIL && 1746 + git checkout -b plain-x509 main && 1747 echo aaa >bar && 1748 git add bar && 1749 git commit -m bar_commit && 1750 + git checkout -b tagged-x509 main && 1751 echo bbb >baz && 1752 git add baz && 1753 git commit -m baz_commit && ··· 1761 ' 1762 1763 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 missing key' ' 1764 + test_when_finished "git reset --hard && git checkout main" && 1765 test_config gpg.format x509 && 1766 test_config user.signingkey $GIT_COMMITTER_EMAIL && 1767 + git checkout -b plain-x509-nokey main && 1768 echo aaa >bar && 1769 git add bar && 1770 git commit -m bar_commit && 1771 + git checkout -b tagged-x509-nokey main && 1772 echo bbb >baz && 1773 git add baz && 1774 git commit -m baz_commit && ··· 1781 ' 1782 1783 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 bad signature' ' 1784 + test_when_finished "git reset --hard && git checkout main" && 1785 test_config gpg.format x509 && 1786 test_config user.signingkey $GIT_COMMITTER_EMAIL && 1787 + git checkout -b plain-x509-bad main && 1788 echo aaa >bar && 1789 git add bar && 1790 git commit -m bar_commit && 1791 + git checkout -b tagged-x509-bad main && 1792 echo bbb >baz && 1793 git add baz && 1794 git commit -m baz_commit && ··· 1838 git init empty && 1839 test_must_fail git -C empty log 2>stderr && 1840 test_i18ngrep does.not.have.any.commits stderr && 1841 + echo 1234abcd >empty/.git/refs/heads/main && 1842 test_must_fail git -C empty log 2>stderr && 1843 test_i18ngrep broken stderr && 1844 echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
+2 -2
t/t4203-mailmap.sh
··· 2 3 test_description='.mailmap configurations' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 197 198 test_expect_success 'setup mailmap blob tests' ' 199 git checkout -b map && 200 - test_when_finished "git checkout master" && 201 cat >just-bugs <<- EOF && 202 Blob Guy <bugs@company.xx> 203 EOF
··· 2 3 test_description='.mailmap configurations' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 197 198 test_expect_success 'setup mailmap blob tests' ' 199 git checkout -b map && 200 + test_when_finished "git checkout main" && 201 cat >just-bugs <<- EOF && 202 Blob Guy <bugs@company.xx> 203 EOF
+14 -14
t/t4204-patch-id.sh
··· 2 3 test_description='git patch-id' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 16 test_write_lines $as b >foo && 17 test_write_lines $as b >bar && 18 git commit -a -m first && 19 - git checkout -b same master && 20 git commit --amend -m same-msg && 21 - git checkout -b notsame master && 22 echo c >foo && 23 echo c >bar && 24 git commit --amend -a -m notsame-msg && ··· 49 } 50 51 test_expect_success 'patch-id detects equality' ' 52 - get_patch_id master && 53 get_patch_id same && 54 - test_cmp patch-id_master patch-id_same 55 ' 56 57 test_expect_success 'patch-id detects inequality' ' 58 - get_patch_id master && 59 get_patch_id notsame && 60 - ! test_cmp patch-id_master patch-id_notsame 61 ' 62 63 test_expect_success 'patch-id supports git-format-patch output' ' 64 - get_patch_id master && 65 git checkout same && 66 git format-patch -1 --stdout | calc_patch_id same && 67 - test_cmp patch-id_master patch-id_same && 68 set $(git format-patch -1 --stdout | git patch-id) && 69 test "$2" = $(git rev-parse HEAD) 70 ' 71 72 test_expect_success 'whitespace is irrelevant in footer' ' 73 - get_patch_id master && 74 git checkout same && 75 git format-patch -1 --stdout | sed "s/ \$//" | calc_patch_id same && 76 - test_cmp patch-id_master patch-id_same 77 ' 78 79 cmp_patch_id () { ··· 91 shift 92 name="order-${1}-$relevant" 93 shift 94 - get_top_diff "master" | calc_patch_id "$name" "$@" && 95 git checkout same && 96 git format-patch -1 --stdout -O foo-then-bar | 97 calc_patch_id "ordered-$name" "$@" && ··· 140 ' 141 142 test_expect_success 'patch-id supports git-format-patch MIME output' ' 143 - get_patch_id master && 144 git checkout same && 145 git format-patch -1 --attach --stdout | calc_patch_id same && 146 - test_cmp patch-id_master patch-id_same 147 ' 148 149 test_expect_success 'patch-id respects config from subdir' '
··· 2 3 test_description='git patch-id' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 16 test_write_lines $as b >foo && 17 test_write_lines $as b >bar && 18 git commit -a -m first && 19 + git checkout -b same main && 20 git commit --amend -m same-msg && 21 + git checkout -b notsame main && 22 echo c >foo && 23 echo c >bar && 24 git commit --amend -a -m notsame-msg && ··· 49 } 50 51 test_expect_success 'patch-id detects equality' ' 52 + get_patch_id main && 53 get_patch_id same && 54 + test_cmp patch-id_main patch-id_same 55 ' 56 57 test_expect_success 'patch-id detects inequality' ' 58 + get_patch_id main && 59 get_patch_id notsame && 60 + ! test_cmp patch-id_main patch-id_notsame 61 ' 62 63 test_expect_success 'patch-id supports git-format-patch output' ' 64 + get_patch_id main && 65 git checkout same && 66 git format-patch -1 --stdout | calc_patch_id same && 67 + test_cmp patch-id_main patch-id_same && 68 set $(git format-patch -1 --stdout | git patch-id) && 69 test "$2" = $(git rev-parse HEAD) 70 ' 71 72 test_expect_success 'whitespace is irrelevant in footer' ' 73 + get_patch_id main && 74 git checkout same && 75 git format-patch -1 --stdout | sed "s/ \$//" | calc_patch_id same && 76 + test_cmp patch-id_main patch-id_same 77 ' 78 79 cmp_patch_id () { ··· 91 shift 92 name="order-${1}-$relevant" 93 shift 94 + get_top_diff "main" | calc_patch_id "$name" "$@" && 95 git checkout same && 96 git format-patch -1 --stdout -O foo-then-bar | 97 calc_patch_id "ordered-$name" "$@" && ··· 140 ' 141 142 test_expect_success 'patch-id supports git-format-patch MIME output' ' 143 + get_patch_id main && 144 git checkout same && 145 git format-patch -1 --attach --stdout | calc_patch_id same && 146 + test_cmp patch-id_main patch-id_same 147 ' 148 149 test_expect_success 'patch-id respects config from subdir' '
+4 -4
t/t4207-log-decoration-colors.sh
··· 5 6 test_description='Test for "git log --decorate" colors' 7 8 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 43 44 cat >expected <<EOF 45 ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD ->\ 46 - ${c_reset}${c_branch}master${c_reset}${c_commit},\ 47 ${c_reset}${c_tag}tag: v1.0${c_reset}${c_commit},\ 48 ${c_reset}${c_tag}tag: B${c_reset}${c_commit})${c_reset} B 49 ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A1${c_reset}${c_commit},\ 50 - ${c_reset}${c_remoteBranch}other/master${c_reset}${c_commit})${c_reset} A1 51 ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_stash}refs/stash${c_reset}${c_commit})${c_reset}\ 52 - On master: Changes to A.t 53 ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A${c_reset}${c_commit})${c_reset} A 54 EOF 55
··· 5 6 test_description='Test for "git log --decorate" colors' 7 8 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 43 44 cat >expected <<EOF 45 ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD ->\ 46 + ${c_reset}${c_branch}main${c_reset}${c_commit},\ 47 ${c_reset}${c_tag}tag: v1.0${c_reset}${c_commit},\ 48 ${c_reset}${c_tag}tag: B${c_reset}${c_commit})${c_reset} B 49 ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A1${c_reset}${c_commit},\ 50 + ${c_reset}${c_remoteBranch}other/main${c_reset}${c_commit})${c_reset} A1 51 ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_stash}refs/stash${c_reset}${c_commit})${c_reset}\ 52 + On main: Changes to A.t 53 ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A${c_reset}${c_commit})${c_reset} A 54 EOF 55
+3 -3
t/t4208-log-magic-pathspec.sh
··· 2 3 test_description='magic pathspec tests using git-log' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 29 ' 30 31 test_expect_success '"git log :/detached -- " should find a commit only in HEAD' ' 32 - test_when_finished "git checkout master" && 33 git checkout --detach && 34 # Must manually call `test_tick` instead of using `test_commit`, 35 # because the latter additionally creates a tag, which would make ··· 122 git checkout HEAD^ && 123 echo 2 >a && 124 git commit -a -m "update a to 2" && 125 - test_must_fail git merge master && 126 git add a && 127 git log --merge -- a 128 '
··· 2 3 test_description='magic pathspec tests using git-log' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 29 ' 30 31 test_expect_success '"git log :/detached -- " should find a commit only in HEAD' ' 32 + test_when_finished "git checkout main" && 33 git checkout --detach && 34 # Must manually call `test_tick` instead of using `test_commit`, 35 # because the latter additionally creates a tag, which would make ··· 122 git checkout HEAD^ && 123 echo 2 >a && 124 git commit -a -m "update a to 2" && 125 + test_must_fail git merge main && 126 git add a && 127 git log --merge -- a 128 '
+1 -1
t/t4211-line-log.sh
··· 1 #!/bin/sh 2 3 test_description='test log -L' 4 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh
··· 1 #!/bin/sh 2 3 test_description='test log -L' 4 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh
+1 -1
t/t4211/history.export
··· 316 return s; 317 } 318 319 - commit refs/heads/master 320 mark :19 321 author Thomas Rast <trast@student.ethz.ch> 1362045024 +0100 322 committer Thomas Rast <trast@student.ethz.ch> 1362045024 +0100
··· 316 return s; 317 } 318 319 + commit refs/heads/main 320 mark :19 321 author Thomas Rast <trast@student.ethz.ch> 1362045024 +0100 322 committer Thomas Rast <trast@student.ethz.ch> 1362045024 +0100
+2 -2
t/t4214-log-graph-octopus.sh
··· 2 3 test_description='git log --graph of skewed left octopus merge.' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 20 test_expect_success 'set up merge history' ' 21 test_commit initial && 22 for i in 1 2 3 4 ; do 23 - git checkout master -b $i || return $? 24 # Make tag name different from branch name, to avoid 25 # ambiguity error when calling checkout. 26 test_commit $i $i $i tag$i || return $?
··· 2 3 test_description='git log --graph of skewed left octopus merge.' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 20 test_expect_success 'set up merge history' ' 21 test_commit initial && 22 for i in 1 2 3 4 ; do 23 + git checkout main -b $i || return $? 24 # Make tag name different from branch name, to avoid 25 # ambiguity error when calling checkout. 26 test_commit $i $i $i tag$i || return $?
+3 -3
t/t4216-log-bloom.sh
··· 1 #!/bin/sh 2 3 test_description='git log for a path with Bloom filters' 4 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh ··· 24 test_commit c10 file_to_be_deleted && 25 git checkout -b side HEAD~4 && 26 test_commit side-1 file4 && 27 - git checkout master && 28 git merge side && 29 test_commit c11 file5 && 30 mv file5 file5_renamed && ··· 97 "--topo-order" \ 98 "--date-order" \ 99 "--author-date-order" \ 100 - "--ancestry-path side..master" 101 do 102 test_expect_success "git log option: $option for path: $path" ' 103 test_bloom_filters_used "$option -- $path" &&
··· 1 #!/bin/sh 2 3 test_description='git log for a path with Bloom filters' 4 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh ··· 24 test_commit c10 file_to_be_deleted && 25 git checkout -b side HEAD~4 && 26 test_commit side-1 file4 && 27 + git checkout main && 28 git merge side && 29 test_commit c11 file5 && 30 mv file5 file5_renamed && ··· 97 "--topo-order" \ 98 "--date-order" \ 99 "--author-date-order" \ 100 + "--ancestry-path side..main" 101 do 102 test_expect_success "git log option: $option for path: $path" ' 103 test_bloom_filters_used "$option -- $path" &&
+11 -11
t/t4253-am-keep-cr-dos.sh
··· 6 test_description='git-am mbox with dos line ending. 7 8 ' 9 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 10 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 11 12 . ./test-lib.sh ··· 46 47 test_expect_success 'am with dos files without --keep-cr' ' 48 git checkout -b dosfiles initial && 49 - git format-patch -k initial..master && 50 test_must_fail git am -k -3 000*.patch && 51 git am --abort && 52 rm -rf .git/rebase-apply 000*.patch ··· 54 55 test_expect_success 'am with dos files with --keep-cr' ' 56 git checkout -b dosfiles-keep-cr initial && 57 - git format-patch -k --stdout initial..master >output && 58 git am --keep-cr -k -3 output && 59 - git diff --exit-code master 60 ' 61 62 test_expect_success 'am with dos files config am.keepcr' ' 63 git config am.keepcr 1 && 64 git checkout -b dosfiles-conf-keepcr initial && 65 - git format-patch -k --stdout initial..master >output && 66 git am -k -3 output && 67 - git diff --exit-code master 68 ' 69 70 test_expect_success 'am with dos files config am.keepcr overridden by --no-keep-cr' ' 71 git config am.keepcr 1 && 72 git checkout -b dosfiles-conf-keepcr-override initial && 73 - git format-patch -k initial..master && 74 test_must_fail git am -k -3 --no-keep-cr 000*.patch && 75 git am --abort && 76 rm -rf .git/rebase-apply 000*.patch ··· 78 79 test_expect_success 'am with dos files with --keep-cr continue' ' 80 git checkout -b dosfiles-keep-cr-continue initial && 81 - git format-patch -k initial..master && 82 append_cr <file1a >file && 83 git commit -m "different patch" file && 84 test_must_fail git am --keep-cr -k -3 000*.patch && 85 append_cr <file2 >file && 86 git add file && 87 git am -3 --resolved && 88 - git diff --exit-code master 89 ' 90 91 test_expect_success 'am with unix files config am.keepcr overridden by --no-keep-cr' ' ··· 93 git checkout -b unixfiles-conf-keepcr-override initial && 94 cp -f file1 file && 95 git commit -m "line ending to unix" file && 96 - git format-patch -k initial..master && 97 git am -k -3 --no-keep-cr 000*.patch && 98 - git diff --exit-code -w master 99 ' 100 101 test_done
··· 6 test_description='git-am mbox with dos line ending. 7 8 ' 9 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 10 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 11 12 . ./test-lib.sh ··· 46 47 test_expect_success 'am with dos files without --keep-cr' ' 48 git checkout -b dosfiles initial && 49 + git format-patch -k initial..main && 50 test_must_fail git am -k -3 000*.patch && 51 git am --abort && 52 rm -rf .git/rebase-apply 000*.patch ··· 54 55 test_expect_success 'am with dos files with --keep-cr' ' 56 git checkout -b dosfiles-keep-cr initial && 57 + git format-patch -k --stdout initial..main >output && 58 git am --keep-cr -k -3 output && 59 + git diff --exit-code main 60 ' 61 62 test_expect_success 'am with dos files config am.keepcr' ' 63 git config am.keepcr 1 && 64 git checkout -b dosfiles-conf-keepcr initial && 65 + git format-patch -k --stdout initial..main >output && 66 git am -k -3 output && 67 + git diff --exit-code main 68 ' 69 70 test_expect_success 'am with dos files config am.keepcr overridden by --no-keep-cr' ' 71 git config am.keepcr 1 && 72 git checkout -b dosfiles-conf-keepcr-override initial && 73 + git format-patch -k initial..main && 74 test_must_fail git am -k -3 --no-keep-cr 000*.patch && 75 git am --abort && 76 rm -rf .git/rebase-apply 000*.patch ··· 78 79 test_expect_success 'am with dos files with --keep-cr continue' ' 80 git checkout -b dosfiles-keep-cr-continue initial && 81 + git format-patch -k initial..main && 82 append_cr <file1a >file && 83 git commit -m "different patch" file && 84 test_must_fail git am --keep-cr -k -3 000*.patch && 85 append_cr <file2 >file && 86 git add file && 87 git am -3 --resolved && 88 + git diff --exit-code main 89 ' 90 91 test_expect_success 'am with unix files config am.keepcr overridden by --no-keep-cr' ' ··· 93 git checkout -b unixfiles-conf-keepcr-override initial && 94 cp -f file1 file && 95 git commit -m "line ending to unix" file && 96 + git format-patch -k initial..main && 97 git am -k -3 --no-keep-cr 000*.patch && 98 + git diff --exit-code -w main 99 ' 100 101 test_done
+1 -1
t/t4257-am-interactive.sh
··· 10 git format-patch --stdout -2 >mbox && 11 12 git reset --hard unrelated && 13 - test_commit conflict-master file master base 14 ' 15 16 # Sanity check our setup.
··· 10 git format-patch --stdout -2 >mbox && 11 12 git reset --hard unrelated && 13 + test_commit conflict-main file main base 14 ' 15 16 # Sanity check our setup.