From f9f30a03107742dc4270dc8e37bc519adc96a475 Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Thu, 14 Jan 2021 15:02:40 -0800 Subject: test-lib-functions.sh: fix usage for test_commit() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The usage comment for test_commit() shows that the --author option should be given as `--author=`. However, this is incorrect as it only works when given as `--author `. Correct this erroneous text. Also, for the sake of correctness, fix the description as well since we invoke `git commit` with `--author `, not `--author=`. Signed-off-by: Denton Liu Acked-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index b0a5d74..cea73cb 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -188,8 +188,8 @@ debug () { # "" # --signoff # Invoke "git commit" with --signoff -# --author= -# Invoke "git commit" with --author= +# --author +# Invoke "git commit" with --author # # This will commit a file with the given contents and the given commit # message, and tag the resulting commit with the given tag name. -- cgit v0.10.2-6-g49f6 From afa80f534b8f7d0422a6e8f208745f3cb94b5d1e Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Thu, 14 Jan 2021 15:02:41 -0800 Subject: t4203: stop losing return codes of git commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In a pipe, only the return code of the last command is used. Thus, all other commands will have their return codes masked. Rewrite pipes so that there are no git commands upstream so that their failure is reported. Signed-off-by: Denton Liu Acked-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index 89cb300..c9cb1aa 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -634,7 +634,8 @@ test_expect_success 'Log output with --use-mailmap' ' Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> EOF - git log --use-mailmap | grep Author >actual && + git log --use-mailmap >log && + grep Author log >actual && test_cmp expect actual ' @@ -651,7 +652,8 @@ test_expect_success 'Log output with log.mailmap' ' Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> EOF - git -c log.mailmap=True log | grep Author >actual && + git -c log.mailmap=True log >log && + grep Author log >actual && test_cmp expect actual ' @@ -665,7 +667,8 @@ test_expect_success 'log.mailmap=false disables mailmap' ' Author: nick1 Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> EOF - git -c log.mailmap=false log | grep Author >actual && + git -c log.mailmap=false log >log && + grep Author log >actual && test_cmp expect actual ' @@ -679,7 +682,8 @@ test_expect_success '--no-use-mailmap disables mailmap' ' Author: nick1 Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> EOF - git log --no-use-mailmap | grep Author > actual && + git log --no-use-mailmap >log && + grep Author log >actual && test_cmp expect actual ' @@ -690,7 +694,8 @@ test_expect_success 'Grep author with --use-mailmap' ' Author: Santa Claus Author: Santa Claus EOF - git log --use-mailmap --author Santa | grep Author >actual && + git log --use-mailmap --author Santa >log && + grep Author log >actual && test_cmp expect actual ' @@ -702,13 +707,15 @@ test_expect_success 'Grep author with log.mailmap' ' Author: Santa Claus EOF - git -c log.mailmap=True log --author Santa | grep Author >actual && + git -c log.mailmap=True log --author Santa >log && + grep Author log >actual && test_cmp expect actual ' test_expect_success 'log.mailmap is true by default these days' ' test_config mailmap.file complex.map && - git log --author Santa | grep Author >actual && + git log --author Santa >log && + grep Author log >actual && test_cmp expect actual ' -- cgit v0.10.2-6-g49f6 From 97f4b4c4e79f7726acca50971b4cf851a3219347 Mon Sep 17 00:00:00 2001 From: Philippe Blain Date: Thu, 14 Jan 2021 22:28:25 -0500 Subject: mailmap doc: use correct environment variable 'GIT_WORK_TREE' gitmailmap(5) uses 'GIT_WORK_DIR' to refer to the root of the repository, but this environment variable does not exist. Use the correct spelling for that variable, 'GIT_WORK_TREE'. Signed-off-by: Philippe Blain Signed-off-by: Junio C Hamano diff --git a/Documentation/gitmailmap.txt b/Documentation/gitmailmap.txt index 7f10897..052209b 100644 --- a/Documentation/gitmailmap.txt +++ b/Documentation/gitmailmap.txt @@ -7,7 +7,7 @@ gitmailmap - Map author/committer names and/or E-Mail addresses SYNOPSIS -------- -$GIT_WORK_DIR/.mailmap +$GIT_WORK_TREE/.mailmap DESCRIPTION -- cgit v0.10.2-6-g49f6 From 2d02bc91c0aa1ced659a21ce75befcd033a4f923 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 14 Jan 2021 12:21:55 -0800 Subject: t4203: make blame output massaging more robust In the "git blame --porcelain" output, lines that ends with three integers may not be the line that shows a commit object with line numbers and block length (the contents from the blamed file or the summary field can have a line that happens to match). Also, the names of the author may have more than three SP separated tokens ("git blame -L242,+1 cf6de18aabf7 Documentation/SubmittingPatches" gives an example). The existing "grep -E | cut" pipeline is a bit too loose on these two points. While they can be assumed on the test data, it is not so hard to use the right pattern from the documented format, so let's do so. Signed-off-by: Junio C Hamano diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index c9cb1aa..a3da473 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -746,11 +746,11 @@ test_expect_success 'Blame --porcelain output (complex mapping)' ' EOF git blame --porcelain one >actual.blame && - grep -E \ - -e "[0-9]+ [0-9]+ [0-9]+$" \ - -e "^author .*$" \ - actual.blame >actual.grep && - cut -d " " -f2-4 actual.fuzz && + + NUM="[0-9][0-9]*" && + sed -n actual.fuzz \ + -e "s/^author //p" \ + -e "s/^$OID_REGEX \\($NUM $NUM $NUM\\)$/\\1/p" && test_cmp expect actual.fuzz ' -- cgit v0.10.2-6-g49f6