{"thread":{"id":"58965","subject":"[PATCH 0/2] Make check-whitespace failures more helpful","startedAt":"2022-12-16T08:32:08Z","lastAt":"2022-12-21T13:46:32Z","messageCount":18,"participants":["Chris. Webster via GitGitGadget","Junio C Hamano","Chris Webster","Đoàn Trần Công Danh"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"469160","messageId":"pull.1444.git.1671179520.gitgitgadget@gmail.com","threadId":"58965","inReplyTo":null,"subject":"[PATCH 0/2] Make check-whitespace failures more helpful","fromName":"Chris. Webster via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-12-16T08:31:58Z","receivedAt":"2022-12-16T08:32:08Z","isPatch":true,"sender":{"key":"name:Chris. Webster","avatar":null},"body":"Add the errors to the job summary along with suggested commands to fix the\nproblem. The commits and filenames are links.\n\nThis is for issue #1395. Sample job output\n[https://github.com/webstech/check-whitespace/actions/runs/3707382446]:\n\n❌ A whitespace issue was found in one or more of the commits.\n\nRun these commands to correct the problem:\n\n1. git rebase --whitespace=fix aaa04a9\n2. git push --force\n\nErrors:\n\n1. --- 5cd37f6 Remove annotations\n   trailing.txt:4: trailing whitespace.\n   +\n   trailing.txt:2: new blank line at EOF.\n\n\nChris. Webster (2):\n  Make `check-whitespace` failures more helpful\n  Improve check-whitespace output\n\n .github/workflows/check-whitespace.yml | 57 +++++++++++++++++++++-----\n 1 file changed, 46 insertions(+), 11 deletions(-)\n\n\nbase-commit: 57e2c6ebbe7108b35ba30184dcbcb6c34c929ad8\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1444%2Fwebstech%2Fwhitespace-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1444/webstech/whitespace-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1444\n-- \ngitgitgadget\n"},{"id":"469161","messageId":"cdc2b1aae81f8c37b4e71cb3e0e382cf82de2272.1671179520.git.gitgitgadget@gmail.com","threadId":"58965","inReplyTo":"pull.1444.git.1671179520.gitgitgadget@gmail.com","subject":"[PATCH 2/2] Improve check-whitespace output","fromName":"Chris. Webster via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-12-16T08:32:00Z","receivedAt":"2022-12-16T08:32:11Z","isPatch":true,"sender":{"key":"name:Chris. Webster","avatar":null},"body":"From: \"Chris. Webster\" <chris@webstech.net>\n\nA message in the step log will refer to the Summary output.\n\nThe job summary output now has links to the commits and files.\n\nSigned-off-by: Chris. Webster <chris@webstech.net>\n---\n .github/workflows/check-whitespace.yml | 34 +++++++++++++++++++-------\n 1 file changed, 25 insertions(+), 9 deletions(-)\n\ndiff --git a/.github/workflows/check-whitespace.yml b/.github/workflows/check-whitespace.yml\nindex 3a99073bc33..da557fd5914 100644\n--- a/.github/workflows/check-whitespace.yml\n+++ b/.github/workflows/check-whitespace.yml\n@@ -20,46 +20,62 @@ jobs:\n     - name: git log --check\n       id: check_out\n       run: |\n+        baseSha=${{github.event.pull_request.base.sha}}\n         problems=()\n         commit=\n         commitText=\n-        lastcommit=\n+        commitTextmd=\n+        goodparent=\n         while read dash sha etc\n         do\n           case \"${dash}\" in\n           \"---\")\n             if test -z \"${commit}\"\n             then\n-              lastcommit=${sha}\n+              goodparent=${sha}\n             fi\n             commit=\"${sha}\"\n             commitText=\"${sha} ${etc}\"\n+            commitTextmd=\"[${sha}](https://github.com/${{ github.repository }}/commit/${sha}) ${etc}\"\n             ;;\n           \"\")\n             ;;\n           *)\n             if test -n \"${commit}\"\n             then\n-              problems+=(\"\" \"--- ${commitText}\")\n+              problems+=(\"1) --- ${commitTextmd}\")\n               echo \"\"\n               echo \"--- ${commitText}\"\n               commit=\n             fi\n-            problems+=(\"${dash} ${sha} ${etc}\")\n-            echo \"${problems[-1]}\"\n+            case \"${dash}\" in\n+            *:[1-9]*:) # contains file and line number information\n+              dashend=${dash#*:}\n+              problems+=(\"[${dash}](https://github.com/${{ github.repository }}/blob/${{github.event.pull_request.head.ref}}/${dash%%:*}#L${dashend%:}) ${sha} ${etc}\")\n+              ;;\n+            *)\n+              problems+=(\"\\`${dash} ${sha} ${etc}\\`\")\n+              ;;\n+            esac\n+            echo \"${dash} ${sha} ${etc}\"\n             ;;\n           esac\n-        done <<< $(git log --check --pretty=format:\"---% h% s\" ${{github.event.pull_request.base.sha}}..)\n+        done <<< $(git log --check --pretty=format:\"---% h% s\" ${baseSha}..)\n \n         if test ${#problems[*]} -gt 0\n         then\n           if test -z \"${commit}\"\n           then\n-            lastcommit=${{github.event.pull_request.base.sha}}\n+            goodparent=${baseSha: 0:7}\n           fi\n-          echo \"A whitespace issue was found in one or more of the commits.\" >$GITHUB_STEP_SUMMARY\n+          echo \"🛑 Please review the Summary output for further information.\"\n+          echo \"### :x: A whitespace issue was found in one or more of the commits.\" >$GITHUB_STEP_SUMMARY\n           echo \"\" >>$GITHUB_STEP_SUMMARY\n-          echo \"Run \\`git rebase --whitespace=fix ${lastcommit}\\` and \\`git push --force\\` to correct the problem.\" >>$GITHUB_STEP_SUMMARY\n+          echo \"Run these commands to correct the problem:\" >>$GITHUB_STEP_SUMMARY\n+          echo \"1. \\`git rebase --whitespace=fix ${goodparent}\\`\" >>$GITHUB_STEP_SUMMARY\n+          echo \"1. \\`git push --force\\`\" >>$GITHUB_STEP_SUMMARY\n+          echo \" \" >>$GITHUB_STEP_SUMMARY\n+          echo \"Errors:\" >>$GITHUB_STEP_SUMMARY\n           for i in \"${problems[@]}\"\n           do\n             echo \"${i}\" >>$GITHUB_STEP_SUMMARY\n-- \ngitgitgadget\n"},{"id":"469162","messageId":"67f60e4e5cbb470bbf3f556f962403af5dd5938c.1671179520.git.gitgitgadget@gmail.com","threadId":"58965","inReplyTo":"pull.1444.git.1671179520.gitgitgadget@gmail.com","subject":"[PATCH 1/2] Make `check-whitespace` failures more helpful","fromName":"Chris. Webster via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-12-16T08:31:59Z","receivedAt":"2022-12-16T08:32:15Z","isPatch":true,"sender":{"key":"name:Chris. Webster","avatar":null},"body":"From: \"Chris. Webster\" <chris@webstech.net>\n\nAdd the errors to the job summary along with suggested\ncommands to fix the problem.\n\nSigned-off-by: Chris. Webster <chris@webstech.net>\n---\n .github/workflows/check-whitespace.yml | 39 +++++++++++++++++++-------\n 1 file changed, 29 insertions(+), 10 deletions(-)\n\ndiff --git a/.github/workflows/check-whitespace.yml b/.github/workflows/check-whitespace.yml\nindex ad3466ad16e..3a99073bc33 100644\n--- a/.github/workflows/check-whitespace.yml\n+++ b/.github/workflows/check-whitespace.yml\n@@ -13,38 +13,57 @@ jobs:\n   check-whitespace:\n     runs-on: ubuntu-latest\n     steps:\n-    - uses: actions/checkout@v2\n+    - uses: actions/checkout@v3\n       with:\n         fetch-depth: 0\n \n     - name: git log --check\n       id: check_out\n       run: |\n-        log=\n+        problems=()\n         commit=\n-        while read dash etc\n+        commitText=\n+        lastcommit=\n+        while read dash sha etc\n         do\n           case \"${dash}\" in\n           \"---\")\n-            commit=\"${etc}\"\n+            if test -z \"${commit}\"\n+            then\n+              lastcommit=${sha}\n+            fi\n+            commit=\"${sha}\"\n+            commitText=\"${sha} ${etc}\"\n             ;;\n           \"\")\n             ;;\n           *)\n             if test -n \"${commit}\"\n             then\n-              log=\"${log}\\n${commit}\"\n+              problems+=(\"\" \"--- ${commitText}\")\n               echo \"\"\n-              echo \"--- ${commit}\"\n+              echo \"--- ${commitText}\"\n+              commit=\n             fi\n-            commit=\n-            log=\"${log}\\n${dash} ${etc}\"\n-            echo \"${dash} ${etc}\"\n+            problems+=(\"${dash} ${sha} ${etc}\")\n+            echo \"${problems[-1]}\"\n             ;;\n           esac\n         done <<< $(git log --check --pretty=format:\"---% h% s\" ${{github.event.pull_request.base.sha}}..)\n \n-        if test -n \"${log}\"\n+        if test ${#problems[*]} -gt 0\n         then\n+          if test -z \"${commit}\"\n+          then\n+            lastcommit=${{github.event.pull_request.base.sha}}\n+          fi\n+          echo \"A whitespace issue was found in one or more of the commits.\" >$GITHUB_STEP_SUMMARY\n+          echo \"\" >>$GITHUB_STEP_SUMMARY\n+          echo \"Run \\`git rebase --whitespace=fix ${lastcommit}\\` and \\`git push --force\\` to correct the problem.\" >>$GITHUB_STEP_SUMMARY\n+          for i in \"${problems[@]}\"\n+          do\n+            echo \"${i}\" >>$GITHUB_STEP_SUMMARY\n+          done\n+\n           exit 2\n         fi\n-- \ngitgitgadget\n\n"},{"id":"469167","messageId":"xmqqo7s3mzlt.fsf@gitster.g","threadId":"58965","inReplyTo":"67f60e4e5cbb470bbf3f556f962403af5dd5938c.1671179520.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 1/2] Make `check-whitespace` failures more helpful","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-12-16T10:06:54Z","receivedAt":"2022-12-16T10:07:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Chris. Webster via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> Subject: Re: [PATCH 1/2] Make `check-whitespace` failures more helpful\n\nPeople usually make changes to the system to make it \"more useful\"\nand/or \"more helpful\", and almost never to make it \"less helpful\".\nPhrases you would use to explain why the failures become more\nhelpful with this change (compared to without) would help to promote\nit in the \"git shortlog --no-merges\" output for the next release.\nE.g. \"make X failures stand out more\", \"make X failures gramatically\ncorrect\", \"show X failures more concisely\", etc.\n\n> diff --git a/.github/workflows/check-whitespace.yml b/.github/workflows/check-whitespace.yml\n> index ad3466ad16e..3a99073bc33 100644\n> --- a/.github/workflows/check-whitespace.yml\n> +++ b/.github/workflows/check-whitespace.yml\n> @@ -13,38 +13,57 @@ jobs:\n>    check-whitespace:\n>      runs-on: ubuntu-latest\n>      steps:\n> -    - uses: actions/checkout@v2\n> +    - uses: actions/checkout@v3\n\nI think we saw changes to upgrade actions/checkout@ in another\ntopic, and it seems that we have missed this one even though we\nshould have upgraded it the same way as other files in the same\ndirectory?  Shouldn't this hunk be a separate topic on its own,\nor at least a separate patch on its own in the series?\n\n>        with:\n>          fetch-depth: 0\n>  \n>      - name: git log --check\n>        id: check_out\n>        run: |\n> -        log=\n> +        problems=()\n\nIs it safe to assume we run Bash here, or can GitHub start using\nother shells that lack the Bash-ism shell arrays and we should\nprotect against such future?\n\nI suspect that we are already depend on <<< Bash-ism, so one more\ndependency to Bash-ism is not a problem here?  I dunno.\n\nThanks.\n"},{"id":"469168","messageId":"xmqqh6xvmzb8.fsf@gitster.g","threadId":"58965","inReplyTo":"cdc2b1aae81f8c37b4e71cb3e0e382cf82de2272.1671179520.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 2/2] Improve check-whitespace output","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-12-16T10:13:15Z","receivedAt":"2022-12-16T10:13:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Chris. Webster via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: \"Chris. Webster\" <chris@webstech.net>\n\n> Subject: Re: [PATCH 2/2] Improve check-whitespace output\n\nThe same comment about specificity of the improvements applies to\nthis one, too.  Also, I forgot to point out that our usual commit\ntitle takes the form of \"<area>: <description>\", e.g.\n\n\tSubject: [PATCH 2/2] ci: show $X in check.whitespace output\n\nwhere \"show $X\" is meant to be a more concrete phrase than \"improve\"\nwhat the change is about and how it improves the output.\n\n> +          echo \"Run these commands to correct the problem:\" >>$GITHUB_STEP_SUMMARY\n> +          echo \"1. \\`git rebase --whitespace=fix ${goodparent}\\`\" >>$GITHUB_STEP_SUMMARY\n> +          echo \"1. \\`git push --force\\`\" >>$GITHUB_STEP_SUMMARY\n\nIt's a bit curious to see two \"1.\" and not \"1.\" followed by \"2.\"\nhere.  Is this meant to be processed by markdown or something so we\ndo not have to do the numbering ourselves, or something?\n\n> +          echo \" \" >>$GITHUB_STEP_SUMMARY\n> +          echo \"Errors:\" >>$GITHUB_STEP_SUMMARY\n>            for i in \"${problems[@]}\"\n>            do\n>              echo \"${i}\" >>$GITHUB_STEP_SUMMARY\n\nThanks.\n"},{"id":"469327","messageId":"CAGT1KpXDHc2bqiiPqxwBiW2UV8BKMnbKD68hKa3fHdCA5GDAzw@mail.gmail.com","threadId":"58965","inReplyTo":"xmqqo7s3mzlt.fsf@gitster.g","subject":"Re: [PATCH 1/2] Make `check-whitespace` failures more helpful","fromName":"Chris Webster","fromEmail":"chris@webstech.net","sentAt":"2022-12-20T00:30:43Z","receivedAt":"2022-12-20T00:31:00Z","isPatch":true,"sender":{"key":"chris@webstech.net","avatar":"https://avatars.githubusercontent.com/u/7956947?v=4"},"body":"On Fri, Dec 16, 2022 at 2:06 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> People usually make changes to the system to make it \"more useful\"\n> and/or \"more helpful\", and almost never to make it \"less helpful\".\n> Phrases you would use to explain why the failures become more\n> helpful with this change (compared to without) would help to promote\n> it in the \"git shortlog --no-merges\" output for the next release.\n> E.g. \"make X failures stand out more\", \"make X failures gramatically\n> correct\", \"show X failures more concisely\", etc.\n\nI will resend with a hopefully better explanation.\n\n> directory?  Shouldn't this hunk be a separate topic on its own,\n> or at least a separate patch on its own in the series?\n\nIt will now be a separate patch.\n\n> Is it safe to assume we run Bash here, or can GitHub start using\n> other shells that lack the Bash-ism shell arrays and we should\n> protect against such future?\n>\n> I suspect that we are already depend on <<< Bash-ism, so one more\n> dependency to Bash-ism is not a problem here?  I dunno.\n\nWhile GitHub could probably allow other shells to be used, changing\nthe default would probably break a lot of things at this point.\n\nThanks for the feedback,\n...chris.\n"},{"id":"469328","messageId":"CAGT1KpXET2kkwKCEpi5Ay=xHsEWLgXzFj9G0cTBFNYvCgAaUfQ@mail.gmail.com","threadId":"58965","inReplyTo":"xmqqh6xvmzb8.fsf@gitster.g","subject":"Re: [PATCH 2/2] Improve check-whitespace output","fromName":"Chris Webster","fromEmail":"chris@webstech.net","sentAt":"2022-12-20T00:33:22Z","receivedAt":"2022-12-20T00:33:40Z","isPatch":true,"sender":{"key":"chris@webstech.net","avatar":"https://avatars.githubusercontent.com/u/7956947?v=4"},"body":"On Fri, Dec 16, 2022 at 2:13 AM Junio C Hamano <gitster@pobox.com> wrote:\n> It's a bit curious to see two \"1.\" and not \"1.\" followed by \"2.\"\n> here.  Is this meant to be processed by markdown or something so we\n> do not have to do the numbering ourselves, or something?\n\nYes, GITHUB_STEP_SUMMARY is treated as markdown.\n\nThanks for the feedback,\n...chris.\n"},{"id":"469329","messageId":"pull.1444.v2.git.1671496548.gitgitgadget@gmail.com","threadId":"58965","inReplyTo":"pull.1444.git.1671179520.gitgitgadget@gmail.com","subject":"[PATCH v2 0/3] Make check-whitespace failures more helpful","fromName":"Chris. Webster via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-12-20T00:35:44Z","receivedAt":"2022-12-20T00:35:54Z","isPatch":true,"sender":{"key":"name:Chris. Webster","avatar":null},"body":"Add the errors to the job summary along with suggested commands to fix the\nproblem. The commits and filenames are links.\n\nThis is for issue #1395. Sample job output\n[https://github.com/webstech/check-whitespace/actions/runs/3707382446]:\n\n❌ A whitespace issue was found in one or more of the commits.\n\nRun these commands to correct the problem:\n\n1. git rebase --whitespace=fix aaa04a9\n2. git push --force\n\nErrors:\n\n1. --- 5cd37f6 Remove annotations\n   trailing.txt:4: trailing whitespace.\n   +\n   trailing.txt:2: new blank line at EOF.\n\n\nChris. Webster (3):\n  ci (check-whitespace): suggest fixes for errors\n  ci (check-whitespace): add links to job output\n  ci (check-whitespace): move to actions/checkout@v3\n\n .github/workflows/check-whitespace.yml | 57 +++++++++++++++++++++-----\n 1 file changed, 46 insertions(+), 11 deletions(-)\n\n\nbase-commit: 57e2c6ebbe7108b35ba30184dcbcb6c34c929ad8\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1444%2Fwebstech%2Fwhitespace-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1444/webstech/whitespace-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/1444\n\nRange-diff vs v1:\n\n 1:  67f60e4e5cb ! 1:  a2b5f3e87d6 Make `check-whitespace` failures more helpful\n     @@ Metadata\n      Author: Chris. Webster <chris@webstech.net>\n      \n       ## Commit message ##\n     -    Make `check-whitespace` failures more helpful\n     +    ci (check-whitespace): suggest fixes for errors\n      \n     -    Add the errors to the job summary along with suggested\n     -    commands to fix the problem.\n     +    Make the errors more visible by adding them to the job summary and\n     +    display the git commands that will usually fix the problem.\n      \n          Signed-off-by: Chris. Webster <chris@webstech.net>\n      \n       ## .github/workflows/check-whitespace.yml ##\n      @@ .github/workflows/check-whitespace.yml: jobs:\n     -   check-whitespace:\n     -     runs-on: ubuntu-latest\n     -     steps:\n     --    - uses: actions/checkout@v2\n     -+    - uses: actions/checkout@v3\n     -       with:\n     -         fetch-depth: 0\n     - \n           - name: git log --check\n             id: check_out\n             run: |\n 2:  cdc2b1aae81 ! 2:  342167ef5bd Improve check-whitespace output\n     @@ Metadata\n      Author: Chris. Webster <chris@webstech.net>\n      \n       ## Commit message ##\n     -    Improve check-whitespace output\n     +    ci (check-whitespace): add links to job output\n      \n          A message in the step log will refer to the Summary output.\n      \n     -    The job summary output now has links to the commits and files.\n     +    The job summary output is using markdown to improve readability.  The\n     +    git commands and commits with errors are now in ordered lists.\n     +    Commits and files in error are links to the user's repository.\n      \n          Signed-off-by: Chris. Webster <chris@webstech.net>\n      \n -:  ----------- > 3:  aa8cd940940 ci (check-whitespace): move to actions/checkout@v3\n\n-- \ngitgitgadget\n"},{"id":"469330","messageId":"a2b5f3e87d6ef62d8005cff5568ad3afc4af3771.1671496548.git.gitgitgadget@gmail.com","threadId":"58965","inReplyTo":"pull.1444.v2.git.1671496548.gitgitgadget@gmail.com","subject":"[PATCH v2 1/3] ci (check-whitespace): suggest fixes for errors","fromName":"Chris. Webster via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-12-20T00:35:45Z","receivedAt":"2022-12-20T00:35:57Z","isPatch":true,"sender":{"key":"name:Chris. Webster","avatar":null},"body":"From: \"Chris. Webster\" <chris@webstech.net>\n\nMake the errors more visible by adding them to the job summary and\ndisplay the git commands that will usually fix the problem.\n\nSigned-off-by: Chris. Webster <chris@webstech.net>\n---\n .github/workflows/check-whitespace.yml | 37 +++++++++++++++++++-------\n 1 file changed, 28 insertions(+), 9 deletions(-)\n\ndiff --git a/.github/workflows/check-whitespace.yml b/.github/workflows/check-whitespace.yml\nindex ad3466ad16e..a0871489b24 100644\n--- a/.github/workflows/check-whitespace.yml\n+++ b/.github/workflows/check-whitespace.yml\n@@ -20,31 +20,50 @@ jobs:\n     - name: git log --check\n       id: check_out\n       run: |\n-        log=\n+        problems=()\n         commit=\n-        while read dash etc\n+        commitText=\n+        lastcommit=\n+        while read dash sha etc\n         do\n           case \"${dash}\" in\n           \"---\")\n-            commit=\"${etc}\"\n+            if test -z \"${commit}\"\n+            then\n+              lastcommit=${sha}\n+            fi\n+            commit=\"${sha}\"\n+            commitText=\"${sha} ${etc}\"\n             ;;\n           \"\")\n             ;;\n           *)\n             if test -n \"${commit}\"\n             then\n-              log=\"${log}\\n${commit}\"\n+              problems+=(\"\" \"--- ${commitText}\")\n               echo \"\"\n-              echo \"--- ${commit}\"\n+              echo \"--- ${commitText}\"\n+              commit=\n             fi\n-            commit=\n-            log=\"${log}\\n${dash} ${etc}\"\n-            echo \"${dash} ${etc}\"\n+            problems+=(\"${dash} ${sha} ${etc}\")\n+            echo \"${problems[-1]}\"\n             ;;\n           esac\n         done <<< $(git log --check --pretty=format:\"---% h% s\" ${{github.event.pull_request.base.sha}}..)\n \n-        if test -n \"${log}\"\n+        if test ${#problems[*]} -gt 0\n         then\n+          if test -z \"${commit}\"\n+          then\n+            lastcommit=${{github.event.pull_request.base.sha}}\n+          fi\n+          echo \"A whitespace issue was found in one or more of the commits.\" >$GITHUB_STEP_SUMMARY\n+          echo \"\" >>$GITHUB_STEP_SUMMARY\n+          echo \"Run \\`git rebase --whitespace=fix ${lastcommit}\\` and \\`git push --force\\` to correct the problem.\" >>$GITHUB_STEP_SUMMARY\n+          for i in \"${problems[@]}\"\n+          do\n+            echo \"${i}\" >>$GITHUB_STEP_SUMMARY\n+          done\n+\n           exit 2\n         fi\n-- \ngitgitgadget\n\n"},{"id":"469331","messageId":"342167ef5bd7f98a7248feea86f4f77b268988bb.1671496548.git.gitgitgadget@gmail.com","threadId":"58965","inReplyTo":"pull.1444.v2.git.1671496548.gitgitgadget@gmail.com","subject":"[PATCH v2 2/3] ci (check-whitespace): add links to job output","fromName":"Chris. Webster via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-12-20T00:35:46Z","receivedAt":"2022-12-20T00:36:00Z","isPatch":true,"sender":{"key":"name:Chris. Webster","avatar":null},"body":"From: \"Chris. Webster\" <chris@webstech.net>\n\nA message in the step log will refer to the Summary output.\n\nThe job summary output is using markdown to improve readability.  The\ngit commands and commits with errors are now in ordered lists.\nCommits and files in error are links to the user's repository.\n\nSigned-off-by: Chris. Webster <chris@webstech.net>\n---\n .github/workflows/check-whitespace.yml | 34 +++++++++++++++++++-------\n 1 file changed, 25 insertions(+), 9 deletions(-)\n\ndiff --git a/.github/workflows/check-whitespace.yml b/.github/workflows/check-whitespace.yml\nindex a0871489b24..552894f736a 100644\n--- a/.github/workflows/check-whitespace.yml\n+++ b/.github/workflows/check-whitespace.yml\n@@ -20,46 +20,62 @@ jobs:\n     - name: git log --check\n       id: check_out\n       run: |\n+        baseSha=${{github.event.pull_request.base.sha}}\n         problems=()\n         commit=\n         commitText=\n-        lastcommit=\n+        commitTextmd=\n+        goodparent=\n         while read dash sha etc\n         do\n           case \"${dash}\" in\n           \"---\")\n             if test -z \"${commit}\"\n             then\n-              lastcommit=${sha}\n+              goodparent=${sha}\n             fi\n             commit=\"${sha}\"\n             commitText=\"${sha} ${etc}\"\n+            commitTextmd=\"[${sha}](https://github.com/${{ github.repository }}/commit/${sha}) ${etc}\"\n             ;;\n           \"\")\n             ;;\n           *)\n             if test -n \"${commit}\"\n             then\n-              problems+=(\"\" \"--- ${commitText}\")\n+              problems+=(\"1) --- ${commitTextmd}\")\n               echo \"\"\n               echo \"--- ${commitText}\"\n               commit=\n             fi\n-            problems+=(\"${dash} ${sha} ${etc}\")\n-            echo \"${problems[-1]}\"\n+            case \"${dash}\" in\n+            *:[1-9]*:) # contains file and line number information\n+              dashend=${dash#*:}\n+              problems+=(\"[${dash}](https://github.com/${{ github.repository }}/blob/${{github.event.pull_request.head.ref}}/${dash%%:*}#L${dashend%:}) ${sha} ${etc}\")\n+              ;;\n+            *)\n+              problems+=(\"\\`${dash} ${sha} ${etc}\\`\")\n+              ;;\n+            esac\n+            echo \"${dash} ${sha} ${etc}\"\n             ;;\n           esac\n-        done <<< $(git log --check --pretty=format:\"---% h% s\" ${{github.event.pull_request.base.sha}}..)\n+        done <<< $(git log --check --pretty=format:\"---% h% s\" ${baseSha}..)\n \n         if test ${#problems[*]} -gt 0\n         then\n           if test -z \"${commit}\"\n           then\n-            lastcommit=${{github.event.pull_request.base.sha}}\n+            goodparent=${baseSha: 0:7}\n           fi\n-          echo \"A whitespace issue was found in one or more of the commits.\" >$GITHUB_STEP_SUMMARY\n+          echo \"🛑 Please review the Summary output for further information.\"\n+          echo \"### :x: A whitespace issue was found in one or more of the commits.\" >$GITHUB_STEP_SUMMARY\n           echo \"\" >>$GITHUB_STEP_SUMMARY\n-          echo \"Run \\`git rebase --whitespace=fix ${lastcommit}\\` and \\`git push --force\\` to correct the problem.\" >>$GITHUB_STEP_SUMMARY\n+          echo \"Run these commands to correct the problem:\" >>$GITHUB_STEP_SUMMARY\n+          echo \"1. \\`git rebase --whitespace=fix ${goodparent}\\`\" >>$GITHUB_STEP_SUMMARY\n+          echo \"1. \\`git push --force\\`\" >>$GITHUB_STEP_SUMMARY\n+          echo \" \" >>$GITHUB_STEP_SUMMARY\n+          echo \"Errors:\" >>$GITHUB_STEP_SUMMARY\n           for i in \"${problems[@]}\"\n           do\n             echo \"${i}\" >>$GITHUB_STEP_SUMMARY\n-- \ngitgitgadget\n\n"},{"id":"469332","messageId":"aa8cd9409401a6407eb6f92bd161ba0562ff3fc8.1671496548.git.gitgitgadget@gmail.com","threadId":"58965","inReplyTo":"pull.1444.v2.git.1671496548.gitgitgadget@gmail.com","subject":"[PATCH v2 3/3] ci (check-whitespace): move to actions/checkout@v3","fromName":"Chris. Webster via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-12-20T00:35:47Z","receivedAt":"2022-12-20T00:36:02Z","isPatch":true,"sender":{"key":"name:Chris. Webster","avatar":null},"body":"From: \"Chris. Webster\" <chris@webstech.net>\n\nGet rid of deprecation warnings in the CI runs.  Also gets the latest\nsecurity patches.\n\nSigned-off-by: Chris. Webster <chris@webstech.net>\n---\n .github/workflows/check-whitespace.yml | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/.github/workflows/check-whitespace.yml b/.github/workflows/check-whitespace.yml\nindex 552894f736a..da557fd5914 100644\n--- a/.github/workflows/check-whitespace.yml\n+++ b/.github/workflows/check-whitespace.yml\n@@ -13,7 +13,7 @@ jobs:\n   check-whitespace:\n     runs-on: ubuntu-latest\n     steps:\n-    - uses: actions/checkout@v2\n+    - uses: actions/checkout@v3\n       with:\n         fetch-depth: 0\n \n-- \ngitgitgadget\n"},{"id":"469340","messageId":"xmqq5ye6zwin.fsf@gitster.g","threadId":"58965","inReplyTo":"CAGT1KpXDHc2bqiiPqxwBiW2UV8BKMnbKD68hKa3fHdCA5GDAzw@mail.gmail.com","subject":"Re: [PATCH 1/2] Make `check-whitespace` failures more helpful","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-12-20T01:36:32Z","receivedAt":"2022-12-20T01:46:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Chris Webster <chris@webstech.net> writes:\n\n>> I suspect that we are already depend on <<< Bash-ism, so one more\n>> dependency to Bash-ism is not a problem here?  I dunno.\n>\n> While GitHub could probably allow other shells to be used, changing\n> the default would probably break a lot of things at this point.\n\nDo we specifically ask for bash in our .github/ files?  That would\nbe perfectly acceptable.  Then we only have to worry about their\nwithdrawing support for bash which would never happen ;-)\n\nThanks.\n"},{"id":"469349","messageId":"CAGT1KpWgu6j-Rb3ezmO+Uwj_LgsgXDbyogkHV=y1099SAk3=Zg@mail.gmail.com","threadId":"58965","inReplyTo":"xmqq5ye6zwin.fsf@gitster.g","subject":"Re: [PATCH 1/2] Make `check-whitespace` failures more helpful","fromName":"Chris Webster","fromEmail":"chris@webstech.net","sentAt":"2022-12-20T05:50:39Z","receivedAt":"2022-12-20T05:50:57Z","isPatch":true,"sender":{"key":"chris@webstech.net","avatar":"https://avatars.githubusercontent.com/u/7956947?v=4"},"body":"On Mon, Dec 19, 2022 at 5:36 PM Junio C Hamano <gitster@pobox.com> wrote:\n> Do we specifically ask for bash in our .github/ files?  That would\n> be perfectly acceptable.  Then we only have to worry about their\n> withdrawing support for bash which would never happen ;-)\n\nWe use the default but the default can be changed\nhttps://docs.github.com/en/actions/using-jobs/setting-default-values-for-jobs.\nIOW we can always use bash if the default changes.\n\n...chris.\n"},{"id":"469356","messageId":"Y6Fle8gzVU5si3T/@danh.dev","threadId":"58965","inReplyTo":"a2b5f3e87d6ef62d8005cff5568ad3afc4af3771.1671496548.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 1/3] ci (check-whitespace): suggest fixes for errors","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2022-12-20T07:34:19Z","receivedAt":"2022-12-20T07:34:27Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"On 2022-12-20 00:35:45+0000, \"Chris. Webster via GitGitGadget\" <gitgitgadget@gmail.com> wrote:\n> From: \"Chris. Webster\" <chris@webstech.net>\n> \n> Make the errors more visible by adding them to the job summary and\n> display the git commands that will usually fix the problem.\n> \n> Signed-off-by: Chris. Webster <chris@webstech.net>\n> ---\n\nI think this change is getting too long to be embeded in a yaml file.\nI think it's better to move the shell code into its own script, so we\ncan have better code highlight in editor and a proper shebang (/bin/bash).\n\n>  .github/workflows/check-whitespace.yml | 37 +++++++++++++++++++-------\n>  1 file changed, 28 insertions(+), 9 deletions(-)\n> \n> diff --git a/.github/workflows/check-whitespace.yml b/.github/workflows/check-whitespace.yml\n> index ad3466ad16e..a0871489b24 100644\n> --- a/.github/workflows/check-whitespace.yml\n> +++ b/.github/workflows/check-whitespace.yml\n> @@ -20,31 +20,50 @@ jobs:\n>      - name: git log --check\n>        id: check_out\n>        run: |\n> -        log=\n> +        problems=()\n>          commit=\n> -        while read dash etc\n> +        commitText=\n> +        lastcommit=\n> +        while read dash sha etc\n>          do\n>            case \"${dash}\" in\n>            \"---\")\n> -            commit=\"${etc}\"\n> +            if test -z \"${commit}\"\n> +            then\n> +              lastcommit=${sha}\n> +            fi\n> +            commit=\"${sha}\"\n> +            commitText=\"${sha} ${etc}\"\n>              ;;\n>            \"\")\n>              ;;\n>            *)\n>              if test -n \"${commit}\"\n>              then\n> -              log=\"${log}\\n${commit}\"\n> +              problems+=(\"\" \"--- ${commitText}\")\n>                echo \"\"\n> -              echo \"--- ${commit}\"\n> +              echo \"--- ${commitText}\"\n> +              commit=\n>              fi\n> -            commit=\n> -            log=\"${log}\\n${dash} ${etc}\"\n> -            echo \"${dash} ${etc}\"\n> +            problems+=(\"${dash} ${sha} ${etc}\")\n> +            echo \"${problems[-1]}\"\n>              ;;\n>            esac\n>          done <<< $(git log --check --pretty=format:\"---% h% s\" ${{github.event.pull_request.base.sha}}..)\n>  \n> -        if test -n \"${log}\"\n> +        if test ${#problems[*]} -gt 0\n>          then\n> +          if test -z \"${commit}\"\n> +          then\n> +            lastcommit=${{github.event.pull_request.base.sha}}\n> +          fi\n> +          echo \"A whitespace issue was found in one or more of the commits.\" >$GITHUB_STEP_SUMMARY\n> +          echo \"\" >>$GITHUB_STEP_SUMMARY\n> +          echo \"Run \\`git rebase --whitespace=fix ${lastcommit}\\` and \\`git push --force\\` to correct the problem.\" >>$GITHUB_STEP_SUMMARY\n\nWhen move this block into its own script, we can use single quote\nstring here, too.\n\n> +          for i in \"${problems[@]}\"\n> +          do\n> +            echo \"${i}\" >>$GITHUB_STEP_SUMMARY\n> +          done\n> +\n>            exit 2\n>          fi\n> -- \n> gitgitgadget\n> \n\n-- \nDanh\n"},{"id":"469392","messageId":"CAGT1KpV0igMKk4FvapuZCdJ7kFS+_cNe2ouczQsomheOGhgLZg@mail.gmail.com","threadId":"58965","inReplyTo":"Y6Fle8gzVU5si3T/@danh.dev","subject":"Re: [PATCH v2 1/3] ci (check-whitespace): suggest fixes for errors","fromName":"Chris Webster","fromEmail":"chris@webstech.net","sentAt":"2022-12-20T19:55:57Z","receivedAt":"2022-12-20T19:57:08Z","isPatch":true,"sender":{"key":"chris@webstech.net","avatar":"https://avatars.githubusercontent.com/u/7956947?v=4"},"body":"> I think this change is getting too long to be embeded in a yaml file.\n> I think it's better to move the shell code into its own script, so we\n> can have better code highlight in editor and a proper shebang (/bin/bash).\n\nThat would need to be a separate patch?\n\n> > +          echo \"Run \\`git rebase --whitespace=fix ${lastcommit}\\` and \\`git push --force\\` to correct the problem.\" >>$GITHUB_STEP_SUMMARY\n>\n> When move this block into its own script, we can use single quote\n> string here, too.\n\nI am not sure what you mean.\n\nThanks for the review,\n...chris.\n"},{"id":"469410","messageId":"Y6JnEQY2VWU8gSZX@danh.dev","threadId":"58965","inReplyTo":"CAGT1KpV0igMKk4FvapuZCdJ7kFS+_cNe2ouczQsomheOGhgLZg@mail.gmail.com","subject":"Re: [PATCH v2 1/3] ci (check-whitespace): suggest fixes for errors","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2022-12-21T01:53:21Z","receivedAt":"2022-12-21T01:53:29Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"On 2022-12-20 11:55:57-0800, Chris Webster <chris@webstech.net> wrote:\n> > I think this change is getting too long to be embeded in a yaml file.\n> > I think it's better to move the shell code into its own script, so we\n> > can have better code highlight in editor and a proper shebang (/bin/bash).\n> \n> That would need to be a separate patch?\n\nYes, I think, a patch to move the whole block into a script, maybe in\nci/ folder.\n> \n> > > +          echo \"Run \\`git rebase --whitespace=fix ${lastcommit}\\` and \\`git push --force\\` to correct the problem.\" >>$GITHUB_STEP_SUMMARY\n> >\n> > When move this block into its own script, we can use single quote\n> > string here, too.\n> \n> I am not sure what you mean.\n\nI mean we can write:\n\n\techo 'Run `git rebase ...` to correct the problem'\n\nWith single quote, we need less escape.\n\n\n-- \nDanh\n"},{"id":"469423","messageId":"CAGT1KpWBVcmxCJf=j7ks7azrX=oj3zLqbrThOjjPLqKu+8rBAg@mail.gmail.com","threadId":"58965","inReplyTo":"Y6JnEQY2VWU8gSZX@danh.dev","subject":"Re: [PATCH v2 1/3] ci (check-whitespace): suggest fixes for errors","fromName":"Chris Webster","fromEmail":"chris@webstech.net","sentAt":"2022-12-21T06:08:58Z","receivedAt":"2022-12-21T06:09:17Z","isPatch":true,"sender":{"key":"chris@webstech.net","avatar":"https://avatars.githubusercontent.com/u/7956947?v=4"},"body":"On Tue, Dec 20, 2022 at 5:53 PM Đoàn Trần Công Danh\n<congdanhqx@gmail.com> wrote:\n> Yes, I think, a patch to move the whole block into a script, maybe in\n> ci/ folder.\n\nMaybe before the next patch or someone could create a check-whitespace\nworkflow action.  Can this patch move forward?  A script would involve\nvalidating parameters or env variables that are just workflow context\nexpressions now (ie more complexity).\n\n> > I am not sure what you mean.\n>\n> I mean we can write:\n>\n>         echo 'Run `git rebase ...` to correct the problem'\n>\n> With single quote, we need less escape.\n\nWhat about ${lastcommit}?  Yes, there is more than one way to do it.\n\nthanks,\n...chris.\n"},{"id":"469436","messageId":"Y6MOLVoo/NtJy1C9@danh.dev","threadId":"58965","inReplyTo":"CAGT1KpWBVcmxCJf=j7ks7azrX=oj3zLqbrThOjjPLqKu+8rBAg@mail.gmail.com","subject":"Re: [PATCH v2 1/3] ci (check-whitespace): suggest fixes for errors","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2022-12-21T13:46:21Z","receivedAt":"2022-12-21T13:46:32Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"On 2022-12-20 22:08:58-0800, Chris Webster <chris@webstech.net> wrote:\n> On Tue, Dec 20, 2022 at 5:53 PM Đoàn Trần Công Danh\n> <congdanhqx@gmail.com> wrote:\n> > Yes, I think, a patch to move the whole block into a script, maybe in\n> > ci/ folder.\n> \n> Maybe before the next patch or someone could create a check-whitespace\n> workflow action.  Can this patch move forward?  A script would involve\n> validating parameters or env variables that are just workflow context\n> expressions now (ie more complexity).\n\nI would say, we can just check an environment variables specific to\nGitHub Action, and print a warning if it's missing. Other than that,\njust process as normal.\n\n> > > I am not sure what you mean.\n> >\n> > I mean we can write:\n> >\n> >         echo 'Run `git rebase ...` to correct the problem'\n> >\n> > With single quote, we need less escape.\n> \n> What about ${lastcommit}?  Yes, there is more than one way to do it.\n\nAh, I misread that part. Sorry.\n\n-- \nDanh\n"}]}