-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix 500 error on repos with no tags #11870
Conversation
go-gitea#11846 Introduced feature to show exact tag on commit view. However if a repo has no tags at all git prints out a separate and unhandled error " No names found, cannot describe anything." Adding --always to the command makes it always use the error in the style of "fatal: no tag exactly matches" even if there are no tags at all. Fixes go-gitea#11869 Fixes go-gitea#11868
I wonder why we even call |
I believe we don't know if a repo has tags or not in this context and if you can run a single command to both find that out and print the tag if so it's better than running two (one to look for tags in general, one to check commit for tag). |
You're right. This does fix the issue by causing git to trigger the other (expected) error:
I think we actually want to ignore all errors printed to stderr for both |
Yes I suspect a more robust error handling not relying on a string is better (I know we do this in a lot of places with git). This was just quick fix to avoid 500 for many commits |
There's no other way to handle git errors I'm afraid. That's why I spent so long to force them to always be in English. |
In some cases we do care about the error but in this case we probably don't. If there are no tags, we don't care about why git can't find them. I was thinking about adding a boolean flag |
Thanks for the fix, really annoying |
go-gitea#11846 Introduced feature to show exact tag on commit view. However if a repo has no tags at all git prints out a separate and unhandled error " No names found, cannot describe anything." Adding --always to the command makes it always use the error in the style of "fatal: no tag exactly matches" even if there are no tags at all. Fixes go-gitea#11869 Fixes go-gitea#11868
#11846 Introduced feature to show exact tag on commit view. However if a repo has no tags at all git prints out a separate and unhandled error " No names found, cannot describe anything.":
gitea/modules/git/commit.go
Line 490 in bc4f7ba
Adding --always to the command makes it always use the error in the style of "fatal: no tag exactly matches" even if there are no tags at all.
Fixes #11869
Fixes #11868