[PR #1932] [MERGED] Gracefully handle bare repositories on API operations. #16130

Closed
opened 2025-11-02 12:02:59 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/1932
Author: @cybe
Created: 6/10/2017
Status: Merged
Merged: 6/11/2017
Merged by: @appleboy

Base: masterHead: api_bare_repos


📝 Commits (1)

  • 8921aba Gracefully handle bare repositories on API operations.

📊 Changes

3 files changed (+12 additions, -2 deletions)

View changed files

📝 models/repo_branch.go (+1 -1)
📝 routers/api/v1/repo/branch.go (+6 -1)
📝 routers/api/v1/repo/file.go (+5 -0)

📄 Description

This pull request places safety checks in front of API operations against potential bare repositories. Previously those operations resulted in internal server errors as a consequence of non zero exit codes by the git module or thrown exceptions.

This is based upon the now merged PR go-gitea/git#39 to the git module which was vendored to the gitea master branch in #1824.

This change was also already partly applied to gogs in gogits/gogs#3996.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/1932 **Author:** [@cybe](https://github.com/cybe) **Created:** 6/10/2017 **Status:** ✅ Merged **Merged:** 6/11/2017 **Merged by:** [@appleboy](https://github.com/appleboy) **Base:** `master` ← **Head:** `api_bare_repos` --- ### 📝 Commits (1) - [`8921aba`](https://github.com/go-gitea/gitea/commit/8921aba2d92c41c5e8b9a4456e597014dfa3284e) Gracefully handle bare repositories on API operations. ### 📊 Changes **3 files changed** (+12 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `models/repo_branch.go` (+1 -1) 📝 `routers/api/v1/repo/branch.go` (+6 -1) 📝 `routers/api/v1/repo/file.go` (+5 -0) </details> ### 📄 Description This pull request places safety checks in front of API operations against potential bare repositories. Previously those operations resulted in internal server errors as a consequence of non zero exit codes by the git module or thrown exceptions. This is based upon the now merged PR go-gitea/git#39 to the git module which was vendored to the gitea master branch in #1824. This change was also already partly applied to gogs in gogits/gogs#3996. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 12:02:59 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#16130