Skip to content

"Deep blame" for squashed commits #2876

Closed

Description

@fregante
  1. Visit https://github.com/sindresorhus/refined-github/blame/0ca864af6da9cac9f503e4abd0c58b60fbe1abc6/source/features/link-to-file-in-file-history.tsx#L29

There's no blame specifically for that line, there's only a big blame block. However if you follow the PR's link, (5 clicks and 4 page loads later) you'll end up on this page:

https://github.com/sindresorhus/refined-github/blame/a2f6e93ca789d2b0677e152bc28d35d4a4180175/source/features/link-to-file-in-file-history.tsx#L34


This feature would need I think:

  1. On blame page, add "deep blame this commit" button on each commit that has a PR link in its title
  2. When the button is clicked, it has to query the API to get the PR's latest commit (user will be shown a loading icon)
  3. Redirect to that commit

Step 2 should (if possible) verify that the linked PR is effectively the one that was squashed, and not just a randomly-linked PR.

Activity

  1. yakov116 commented on Mar 8, 2020

    @yakov116
    Member

    I dont think we should load it on blame.

    Rather allow the user to click alt and then load

    {
      repository(owner: "sindresorhus", name: "refined-github") {
        object(expression: "ad17f062d53fa911c131ce1be964e1d20d5e6f72") {
          ... on Commit {
            associatedPullRequests(last: 1) {
              nodes {
                mergeCommit {
                  oid
                }
                commits(last: 1) {
                  nodes {
                    commit {
                      oid
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    
    const pullRequests = select.all('[data-hovercard-type="pull_request"]')
    
    for (const pullRequest of pullRequests) {
    	console.log(pullRequest.nextElementSibling.href.split('/')[6])
    }

    And redirect to that commit

    Side Note: @github we changed the clock...
    image

  2. fregante commented on Mar 8, 2020

    @fregante
    MemberAuthor

    Rather allow the user to click alt and then load

    Yeah that’s what I said, only after the user clicks on it because it requires a specific query per commit

  3. yakov116 commented on Mar 8, 2020

    @yakov116
    Member

    Rather allow the user to click alt and then load

    Yeah that’s what I said, only after the user clicks on it because it requires a specific query per commit

    Alt click?
    Then redirect to blame of last commit of the pr

  4. yakov116 commented on Mar 8, 2020

    @yakov116
    Member

    Step 2 should (if possible) verify that the linked PR is effectively the one that was squashed, and not just a randomly-linked PR.

    I was thinking to take the commit and get the associated pr with it

    I added to the query the merge commit that we can compare it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions