Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show tags in commit history #807

Closed
freaktechnik opened this issue Nov 11, 2017 · 23 comments · Fixed by #2026
Closed

Show tags in commit history #807

freaktechnik opened this issue Nov 11, 2017 · 23 comments · Fixed by #2026
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted

Comments

@freaktechnik
Copy link

freaktechnik commented Nov 11, 2017

Issuehunt badges

Add a link to a tag that is set on a commit when looking at the commit history. This makes it easier to identify new commits that haven't been released yet, or identify change ranges.

I realize you can use the pull request/diffing UI for that, but that's way more complicated than looking at the history, especially when a tag only includes a few commits. Plus you need to know the tag name in to compare, since those are not auto completed by the UI.


IssueHunt Summary

dotconnor dotconnor has been rewarded.

Backers (Total: $65.00)

Submitted pull Requests


Tips


IssueHunt has been backed by the following sponsors. Become a sponsor

@hkdobrev
Copy link
Contributor

Hi @freaktechnik! Thanks for the suggestion!

To clarify, you mean pages like this one, correct?
https://github.com/sindresorhus/refined-github/commits/master

@freaktechnik
Copy link
Author

freaktechnik commented Nov 11, 2017

Yes, and I think a commit already shows the tag as I'd suggest here, so essentially adding that info to the upper level.
Example: 03fa6b8

@hkdobrev
Copy link
Contributor

OK, this would be very useful, but I don't think it's really feasible at the moment as we'd need to either perform a HTTP call for every commit on the page (where each could be a huge response we need to parse) or to try to use the API with authentication which we're trying to avoid if possible.

This would be very easy for GitHub to add as they already save the tags and PRs related to a commit, but they expose it only on the commit page.

I'd suggest contacting GitHub on https://github.com/contact requesting that feature from them.

If anyone knows a good approach this, please let us know!


Plus you need to know the tag name in to compare, since those are not auto completed by the UI.

We can probably do that in the compare UI - suggest tags in an autocomplete.

@fregante
Copy link
Member

With the API we could query the repo's refs (paged) and match them to whatever commits are visible on the current page. It probably wouldn't require more than 1-2 extra HTTP requests per commit page, which is fine for me.

This is definitely a feature I'd like and use. I don't mind finally seeing API integration, we already even have a GHE API URL helper

@ramlmn
Copy link

ramlmn commented Nov 14, 2017

It probably wouldn't require more than 1-2 extra HTTP requests per commit page

That would still exhaust the GitHub's API limit easily just by moving through commit pages front and back. Caching them would also be a problem by itself.

Even if we wanted to add an option for the user to have their own OAuth token, that would not be agreed by @sindresorhus as already dicussessd in #581 (comment).

Maybe this could be a real use case for some !?🤷‍♂️

@fregante
Copy link
Member

fregante commented Nov 14, 2017

He's ok with the option if it's really needed: #741 (comment)

In this case I guess the API would be replaced by fetching https://github.com/avajs/ava/tags

But honestly I don't see why be strict with the API at all: it saves bandwidth, GH won't change its structure without warning (it happens if we just parse HTML pages) and it only requires a couple more clicks for the setup, which is done once.

@ramlmn
Copy link

ramlmn commented Nov 14, 2017

He's ok with the option if it's really needed: #741 (comment)

Either we use API everywhere or nowhere at all

In this case I guess the API would be replaced by fetching avajs/ava/tags

Matching tags with the respective commits by itself would be another problem, requiring to load all tag pages for each commit page visit.

But honestly I don't see why be strict with the API at all: it saves bandwidth and it only requires a couple more clicks for the setup, which is done once.

👍 Honestly RG has done enough page scraping already!


@sindresorhus WDYT?

@hkdobrev
Copy link
Contributor

hkdobrev commented Nov 14, 2017

After watching some of the GitHub satellite videos and especially the first keynote, I think it would be best to utilize the API v4 using GraphQL. GitHub's vision is to build the whole github.com on top of the GraphQL API and provide the same tools and platform their developers have to everyone. With this, most modifications to github.com which a browser extension might want to do would be possible and performant over GraphQL calls.

However, this is not fully featured yet and I'd recommend waiting or building that in a separate extension for now in order to reduce complexity and maintenance until we have a solid platform to use for many features.

@yakov116
Copy link
Member

@hkdobrev I have waaay to much experience with graphQL.

  1. Must be authenticated and cannot be anonymous. (so certain things would not work without a token)
  2. They are always changing stuff.

I helped @k0shk0sh build FastHub we spent 2 months trying to switch to V4 and we ended up reverting the whole thing.
If it was me I would wait another 4-5 months. Lately they have been adding many more typical things. IMHO it's worth the wait

@hkdobrev
Copy link
Contributor

@yakov116 👍 and re the authentication - of course, I think it would be worth the hassle of people needing to configure anything or approve an app or something to use the extension to its fullest extent.

@sindresorhus
Copy link
Member

👍 I would find this very useful.

@yakov116

This comment has been minimized.

@fregante

This comment has been minimized.

@yakov116

This comment has been minimized.

@yakov116
Copy link
Member

Bump we now have the token so...

@obahareth
Copy link

I'd like to take this, are there any examples I should use as a starting point?

@fregante
Copy link
Member

fregante commented Mar 4, 2019

I hope this answers your question.

Similar features

Commit list: https://github.com/sindresorhus/refined-github/blob/master/source/features/mark-merge-commits-in-list.tsx

Multi-query v4 API (if required): https://github.com/sindresorhus/refined-github/blob/master/source/features/pr-branches.tsx

Affected pages

https://github.com/sindresorhus/element-ready/commits/master

Also keep in mind that some commits may have multiple tags.

For packages that use version commits this would be of dubious utility (as seen in the screenshot)

Design

// Code for the demo screenshot
document.querySelector('.commit-indicator').insertAdjacentHTML('beforebegin', `
	<div class="ml-2">
		<svg aria-hidden="true" class="octicon octicon-tag" width="14" height="16"><path d="M6.73 2.73c-0.47-0.47-1.11-0.73-1.77-0.73H2.5C1.13 2 0 3.13 0 4.5v2.47c0 0.66 0.27 1.3 0.73 1.77l6.06 6.06c0.39 0.39 1.02 0.39 1.41 0l4.59-4.59c0.39-0.39 0.39-1.02 0-1.41L6.73 2.73zM1.38 8.09c-0.31-0.3-0.47-0.7-0.47-1.13V4.5c0-0.88 0.72-1.59 1.59-1.59h2.47c0.42 0 0.83 0.16 1.13 0.47l6.14 6.13-4.73 4.73L1.38 8.09z m0.63-4.09h2v2H2V4z"></path></svg>
		${document.querySelector('.commit-title').textContent}
	</div>
`)

@IssueHuntBot
Copy link

@IssueHunt has funded $60.00 to this issue.


@fregante
Copy link
Member

I want to take this, but the API does not show which tags are on a specific commit:

https://developer.github.com/v4/object/commit/

This means that the only way to do this seems to be Fetch all tags page by page until they're found. The API doesn't even seem to pickup the before/after markers to limit the search to the visible commits:

# https://developer.github.com/v4/explorer/
query { 
  repository(owner: "sindresorhus", name: "caprine") { 
    refs(refPrefix: "refs/tags/", last: 100, after: "77e6951397dab721419bafa90a5d6744310e1e7f", before: "79fa563090f14199b8988722f1c4c4b95069cb59") {
      nodes {
        name
        target {
        	commitUrl
        }
      }
    }
  }
}

Neither v3 and v4 search queries include tags.

@obahareth
Copy link

obahareth commented Apr 20, 2019

@bfred-it When I was working on this (but I sadly stopped because I had to move) I was able to get the tags using this query:

{
  repository(owner: "sindresorhus", name: "element-ready") {
    refs(first: 100, refPrefix: "refs/tags/") {
      edges {
        node {
          target {
            ... on Tag {
              name
              commitResourcePath
            }
          }
        }
      }
    }
  }
}

name is the tag name, the response will look like this:

{
  "data": {
    "repository": {
      "refs": {
        "edges": [
          {
            "node": {
              "target": {
                "name": "v0.1.0",
                "commitResourcePath": "/sindresorhus/element-ready/commit/f68100c11e5eec3ae45e9fe854691fb694af10c0"
              }
            }
          },
          {
            "node": {
              "target": {
                "name": "v0.2.0",
                "commitResourcePath": "/sindresorhus/element-ready/commit/95f80a9e26904bd9c30774a40fb83ebed0c56af9"
              }
            }
          },
          {
            "node": {
              "target": {
                "name": "v1.0.0",
                "commitResourcePath": "/sindresorhus/element-ready/commit/26cf4445a2460a9b1df5b336b018d471e1a10f27"
              }
            }
          },
          {
            "node": {
              "target": {
                "name": "v2.0.0",
                "commitResourcePath": "/sindresorhus/element-ready/commit/b2d64d08f02ed5c3daa5393caf6ff4d8f25afb78"
              }
            }
          },
          {
            "node": {
              "target": {
                "name": "v2.1.0",
                "commitResourcePath": "/sindresorhus/element-ready/commit/faf1a61170450015de9b24ea9439fae4250a9bbb"
              }
            }
          },
          {
            "node": {
              "target": {
                "name": "v2.2.0",
                "commitResourcePath": "/sindresorhus/element-ready/commit/a8652a3facc2ad0a7717f1d773d754dc89834bb7"
              }
            }
          },
          {
            "node": {
              "target": {
                "name": "v2.2.1",
                "commitResourcePath": "/sindresorhus/element-ready/commit/0ea70435fa5771a7f7637f3525ccf7e4e0063fb9"
              }
            }
          },
          {
            "node": {
              "target": {
                "name": "v3.0.0",
                "commitResourcePath": "/sindresorhus/element-ready/commit/61003ded56d37ec5a28f9a42258d5b12015e7469"
              }
            }
          },
          {
            "node": {
              "target": {
                "name": "v3.1.0",
                "commitResourcePath": "/sindresorhus/element-ready/commit/840f1e81102bdf208d0e9ecf2015ea253a64f630"
              }
            }
          }
        ]
      }
    }
  }
}

Also the before and after values you're using are commit hashes, they should be cursors (that you request and that get returned by the API) instead.

I hope that helps.

@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label May 10, 2019
@simonkotwicz
Copy link
Contributor

simonkotwicz commented May 15, 2019

Yes, and I think a commit already shows the tag as I'd suggest here, so essentially adding that info to the upper level.
Example: 03fa6b8

Seems like tags are only shown for commits that exist in the main/master branch (when looking at a single commit)

@fregante fregante added the has PR label Jun 5, 2019
@issuehunt-oss
Copy link

issuehunt-oss bot commented Aug 17, 2019

@jerone has funded $5.00 to this issue.


@issuehunt-oss
Copy link

issuehunt-oss bot commented Oct 28, 2019

@sindresorhus has rewarded $58.50 to @dotconnor. See it on IssueHunt

  • 💰 Total deposit: $65.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $6.50

@issuehunt-oss issuehunt-oss bot added 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt and removed 💵 Funded on Issuehunt This issue has been funded on Issuehunt labels Oct 28, 2019
@refined-github refined-github locked as resolved and limited conversation to collaborators Aug 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted
Development

Successfully merging a pull request may close this issue.

8 participants