Enhance /compare/ for tags and abbreviated commit shas #2121

Closed
opened 2025-11-02 04:24:43 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @ghost on GitHub (Jul 31, 2018).

Gitea version (or commit ref): 55d9ddf

Description

This works:
/compare/d40cdb7ded29d1f406a2575ee03030b32f6d7114...2964016d5ae44fb587b96802f4e2bceadff6b2ee

This doesn't but probably should:
/compare/d40cdb7...2964016

This doesn't but probably should:
/compare/v1.1.1...v1.1.2

Basically anything that is commitish should compare with assumption 7 chars in the commit sha is enough to ensure uniqueness.

Originally created by @ghost on GitHub (Jul 31, 2018). Gitea version (or commit ref): `55d9ddf` ## Description This works: <samp>/compare/d40cdb7ded29d1f406a2575ee03030b32f6d7114...2964016d5ae44fb587b96802f4e2bceadff6b2ee</samp> This doesn't but probably should: <samp>/compare/d40cdb7...2964016</samp> This doesn't but probably should: <samp>/compare/v1.1.1...v1.1.2</samp> Basically anything that is commitish should compare with assumption 7 chars in the commit sha is enough to ensure uniqueness.
GiteaMirror added the type/proposaltype/enhancement labels 2025-11-02 04:24:43 -06:00
Author
Owner

@saitho commented on GitHub (Apr 27, 2019):

Supporting short hashes is related to https://github.com/src-d/go-git/issues/602, since Gitea uses go-git to check if the reference exists.

@saitho commented on GitHub (Apr 27, 2019): Supporting short hashes is related to https://github.com/src-d/go-git/issues/602, since Gitea uses go-git to check if the reference exists.
Author
Owner

@richmahn commented on GitHub (May 29, 2019):

@saitho Do you know why though you can see a commit with a short commit hash? E.g. https://try.gitea.io/richmahn/test/commit/f713fac works for me

@richmahn commented on GitHub (May 29, 2019): @saitho Do you know why though you can see a commit with a short commit hash? E.g. https://try.gitea.io/richmahn/test/commit/f713fac works for me
Author
Owner

@saitho commented on GitHub (May 29, 2019):

Hmm... haven't tried that yet. Maybe that's one doesn't rely on go-git? I'll look into that. :)

@saitho commented on GitHub (May 29, 2019): Hmm... haven't tried that yet. Maybe that's one doesn't rely on go-git? I'll look into that. :)
Author
Owner

@richmahn commented on GitHub (May 29, 2019):

I wonder if it has to do something in the likes of a git log | grep <short hash> or something to then find the long hash from the output?

@richmahn commented on GitHub (May 29, 2019): I wonder if it has to do something in the likes of a `git log | grep <short hash>` or something to then find the long hash from the output?
Author
Owner

@zeripath commented on GitHub (May 29, 2019):

I just pushed a commit to the #6991 PR which adds the ability to use the commit SHA.

@zeripath commented on GitHub (May 29, 2019): I just pushed a commit to the #6991 PR which adds the ability to use the commit SHA.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2121