Skip to content

repo-age should display the date of the first commit #2660

Closed

Description

@webknjaz

PR #2560 uses the repo creation time to show the age. This may be confusing and misleading by tricking people into thinking it's a project age.

Some projects may migrate between code hostings over time. For example, for https://github.com/cherrypy/cherrypy Refined GitHub shows the age of 3 years while it's way older: the first commit is dated 2004 (I think the project started ~2002 but the version control doesn't have that info).

So it would be nice to have some switch to enable using the oldest commit date instead of the repo creation time.

Activity

  1. yakov116 commented on Dec 30, 2019

    @yakov116
    Member
  2. webknjaz commented on Dec 30, 2019

    @webknjaz
    Author

    Well, I'm okay with an extra query. Plus this mode could be disabled by default if this many queries is too much for someone.

  3. yakov116 commented on Dec 30, 2019

    @yakov116
    Member

    "Disabled by default" means most people don't need it, so it doesn't belong to Refined GitHub. In that case, it's best to keep it as a standalone userscript or extension.
    #2625 (comment)

  4. sindresorhus commented on Dec 30, 2019

    @sindresorhus
    Member

    Projects imported to GitHub is too much of an edge-case. What we could do is to add a tooltip that says that the age is the GitHub repo ago.

  5. fregante commented on Dec 31, 2019

    @fregante
    Member

    What we could do is to add a tooltip that says that the age is the GitHub repo ago.

    And/or this issue can stay open as a wish to improve on the feature if possible.

  6. changed the title [-]Option to show the project age[/-] [+]`repo-age` should display the date of the first commit[/+] on Dec 31, 2019
  7. webknjaz commented on Dec 31, 2019

    @webknjaz
    Author

    is too much of an edge-case

    Not at all. Most of the today's well-established projects were hosted somewhere else. A lot of them survived multiple migrations and CVSs.

    A good example would be CPython: migrated ~2 years ago, first commit ~20 years ago. python/cpython@7f777ed

  8. yakov116 commented on Jan 1, 2020

    @yakov116
    Member

    I think the tootip says it all "Repository Created...." is has nothing to do with the commit date. Its when the github project was created

    Not at all. Most of the today's well-established projects were hosted somewhere else. A lot of them survived multiple migrations and CVSs.

    I think (IMHO) the repo age is most beneficial for repo's that are not widely known and the user would like to know its age. For the large projects there is no real benefit knowing when they went into existence.
    Again JMO

  9. fregante commented on Jan 4, 2020

    @fregante
    Member

    Edge case or not, if it was easy to get the first commit date I’d prefer that over “repo created”, which is just a GitHub event rather than the source’s birth date.

    We could still also display the Created date in the tooltip for clarity

  10. hardikmodha commented on Jan 5, 2020

    @hardikmodha
    Contributor

    Just stumbled upon this and after a quick Google search, found a way to fetch the first commit date for a repository. Reference: https://stackoverflow.com/a/49647826/4248342

    This certainly is not feasible with 1 HTTP request, we need to make 2 HTTP requests.

    e.g. I tried it for https://github.com/python/cpython/ and it seems to be working fine. Number of commits: 106075 (Count is available on the repo code page)

    1. Navigate to the commits page. (1st request)
    2. Pick the URL from the pagination Older button which is https://github.com/python/cpython/commits/master?after=b19c0d77e6f25ea831ab608c71f15d0d9266c8c4+34.
    3. Modify the count after + with 106075 - 34 - 1 (last commit) = 106040
      New URL: https://github.com/python/cpython/commits/master?after=b19c0d77e6f25ea831ab608c71f15d0d9266c8c4+106040 and visit it. (2nd request)
    4. The last item on this page is the first commit on this default branch. We can pick the date and time from there which is 1990-08-09T14:25:15Z

    What do you all think?

  11. yakov116 commented on Jan 5, 2020

    @yakov116
    Member
  12. hardikmodha commented on Jan 5, 2020

    @hardikmodha
    Contributor

    Haha..just realized it after your comment. We do have the last commit. It will be only 1 HTTP request.

  13. yakov116 commented on Jan 5, 2020

    @yakov116
    Member

    @hardikmodha but it will have to wait until the page loaded

  14. hardikmodha commented on Jan 5, 2020

    @hardikmodha
    Contributor

    Yeah, that is there but wouldn't that be okay? Since it would be a one-time request and first commit isn't supposed to change so we can cache it forever. What do you think?

  15. fregante commented on Jan 5, 2020

    @fregante
    Member

    🎉 Indeed it takes one HTTP request if you have the latest commit and commit count:

    https://github.com/sindresorhus/refined-github/commits/master?after=a76ed868a84cd0078d8423999faaba7380b0df1b+1571

    a76ed86 is the latest commit and 1573 is the visible commit count (-2)

  16. hardikmodha commented on Jan 5, 2020

    @hardikmodha
    Contributor

    @yakov116 I don't think that would be feasible here since we need to wait for the .overall-summary to load to figure out a place to append the repo age. https://github.com/sindresorhus/refined-github/blob/master/source/features/repo-age.tsx#L44 So I'm not sure where to display the loader.

  17. added a commit that references this issue on Jan 5, 2020
    a52da6a
  18. yakov116 commented on Jan 5, 2020

    @yakov116
    Member

    Maybe say Loading...

  19. added a commit that references this issue on Jan 5, 2020
    b486593
  20. webknjaz commented on Jan 5, 2020

    @webknjaz
    Author

    so we can cache it forever.

    It can change because it can be force-pushed or the default branch can be switched to a different tree.

  21. hardikmodha commented on Jan 14, 2020

    @hardikmodha
    Contributor

    @webknjaz Yeah, it is possible. If default branch is changed then it will display wrong first commit date. E.g. Just found out that ydkjs has changed it's default branch from master to 2nd-ed https://github.com/getify/You-Dont-Know-JS. If we have some way of knowing the oldest branch then this would be correct.

    @fregante Not sure which one can be more frequent. Migrated repos vs different default branches. 🤔 Also, Not sure if we should do it, but a thought, we can fetch both the repo created date using API and fetch the date of first commit, whichever is older we can display that. But then it will be 2 requests.

  22. fregante commented on Jan 15, 2020

    @fregante
    Member

    In this situation specifically, you're talking about force-pushes and default branch updates that change the very first commit. I'd say that's so rare it's not even worth discussing.

    I'm not particularly worried about displaying slightly-off age information in that situation, it's not critical information.

    Ideally yes, we'd show the earliest date between first commit and createdAt, but it's not worth 2 requests.

  23. hardikmodha commented on Jan 18, 2020

    @hardikmodha
    Contributor

    Ideally yes, we'd show the earliest date between first commit and createdAt, but it's not worth 2 requests.

    I get your point but the request will be made only for the first time (and when the cache expires that is 30 days). Also, the requests are independent of each other.

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