git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] ci: github action - add check for whitespace errors

From
Jeff King <peff@peff.net>
Date
Sep 24, 2020, 06:51 UTC
Message-ID
<20200924065129.GB1851751@coredump.intra.peff.net>
In-Reply-To
<CAGT1KpVmeT+nT1-Pfwa_M8BptFYwRTL4ofM0k6UOOzkYh0kucw@mail.gmail.com>
On Tue, Sep 22, 2020 at 03:17:54PM -0700, Chris Webster wrote:
Show 12 quoted lines
> On Tue, Sep 22, 2020 at 10:07 AM Jeff King <peff@peff.net> wrote:
> >  - for a linear branch on top of master, using the commit count will
> >    work reliably. But I suspect it would run into problems if there were
> >    ever a merge on a PR (e.g., back-merging from master), where we'd be
> >    subject to how `git log` linearizes the commits. That's not really a
> >    workflow I'd expect people to use with git.git, but it would probably
> >    be easy to make it more robust. Does the PR object provide the "base"
> >    oid, so we could do "git log $base..$head"?
> 
> GitGitGadget PR linting is going to flag merges in the PR and request
> a rebase.  If I understand correctly, that means back-merging is not
> part of the workflow.

Yeah, I would definitely be surprised to see it used with a git PR, but I didn't realize there was other linting that would actually complain about it.

Show 5 quoted lines
> The checkout is limited to improve performance
> and reduce resources.  In the PR object, the base is the branch.  The
> github api would need to be used to get more detailed information.
> The "base" is not really part of the checkout so it can not be
> referenced in the git log command (without doing a larger checkout).
Hmm.
  git clone --shallow-exclude=HEAD --single-branch -b $branch
  git log --check

_almost_ works. The problem is that the shallow graft means that the bottom commit looks like it introduces every file. We really want to graft at HEAD^, but the server side only accepts exact refnames. You could work around it with a followup:

  git fetch --deepen 1

which is getting a bit convoluted. I suspect you may also have to abandon the "checkout" action and do this manually. Definitely not worth it compared to your solution for a PR, but maybe worth it if it lets us do the same thing for arbitrary branches.

-Peff
Previous: Chris WebsterNext: Chris Webster
Message 15 of 17 in “ci: github action - add check for whitespace errors”
  1. ci: github action - add check for whitespace errorsChris. Webster via GitGitGadget, Sep 22, 2020
  2. Jeff KingSep 22, 2020
  3. Junio C HamanoSep 22, 2020
  4. Chris WebsterSep 22, 2020
  5. Chris WebsterOct 9, 2020
  6. Johannes SchindelinOct 9, 2020
  7. Junio C HamanoOct 9, 2020
  8. Jeff KingOct 9, 2020
  9. Junio C HamanoOct 9, 2020
  10. Jeff KingOct 9, 2020
  11. Junio C HamanoOct 9, 2020
  12. Chris WebsterOct 10, 2020
  13. Junio C HamanoOct 10, 2020
  14. Chris WebsterSep 22, 2020
  15. Jeff KingSep 24, 2020
  16. Chris WebsterSep 25, 2020
  17. Jeff KingSep 25, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.