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

Sort branches and tags by date descending #21136

Merged

Conversation

sergemedvid
Copy link
Contributor

@sergemedvid sergemedvid commented Sep 10, 2022

This PR fixes #5709 and #17316 by changing the order of listed branches and tags to show the ones with latest commits atop.
It's achieved with changing underlying "show-ref" git command with "for-each-ref" as suggested in https://stackoverflow.com/a/5188364
Also, it's passing format string so the output matches "show-ref" command output.

close #5709
close #17316

@silverwind silverwind added the type/enhancement An improvement of existing functionality label Sep 11, 2022
@silverwind
Copy link
Member

This doesn't raise the minimum git version (currently 2.0.0), right?

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 11, 2022
@delvh
Copy link
Member

delvh commented Sep 11, 2022

According to the linked stackoverflow, it would raise it to 2.7.0.

@sergemedvid
Copy link
Contributor Author

This doesn't raise the minimum git version (currently 2.0.0), right?

No, it doesn’t. The “for-each-ref” command was available in 2.0.0: https://github.com/git/git/blob/v2.0.0/Documentation/git-for-each-ref.txt

According to the linked stackoverflow, it would raise it to 2.7.0.

The linked stackoverflow mentions 2.7.0 in context that sorting became available for “git branch” command.

@delvh
Copy link
Member

delvh commented Sep 11, 2022

Yep, I misread that.

@silverwind
Copy link
Member

for-ref-each seems to have been introduced in git/git@9f613dd, version 1.4.4.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Sep 13, 2022
@6543 6543 added this to the 1.18.0 milestone Sep 14, 2022
@6543 6543 changed the title Sort branches and tags by date descending (#5709, #17316) Sort branches and tags by date descending Sep 14, 2022
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Sep 14, 2022
@6543 6543 merged commit e07d089 into go-gitea:main Sep 14, 2022
if arg != "" {
args = append(args, arg)
args = append(args, strings.Fields(arg)...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Splitting arguments by space is dangerous.

zjjhot added a commit to zjjhot/gitea that referenced this pull request Sep 15, 2022
* upstream/main:
  Display image digest for container packages (go-gitea#21170)
  Use correct branch for .editorconfig error (go-gitea#21152)
  Passing command line arguments correctly by string slice (go-gitea#21168)
  Sort branches and tags by date descending (go-gitea#21136)
  Skip dirty check for team forms (go-gitea#21154)
  Add KaTeX rendering to Markdown. (go-gitea#20571)
@iranvir
Copy link

iranvir commented Oct 21, 2022

Can someone please show how to turn this feature on in the Gitea UI? Is there a configuration line that needs to be added?

@6543
Copy link
Member

6543 commented Oct 21, 2022

@iranvir if you dont use current dev version it's not released

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Oct 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sort tag listing by alphanumeric values Branch sorting (branches and PR page)
8 participants