[PR #1829] [MERGED] Commitless repos should be bare #16070

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

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/1829
Author: @ethantkoenig
Created: 5/29/2017
Status: Merged
Merged: 6/12/2017
Merged by: @andreynering

Base: masterHead: no_branches


📝 Commits (1)

  • c85ff53 Commitless repos should be bare

📊 Changes

2 files changed (+5 additions, -1 deletions)

View changed files

📝 models/action.go (+1 -1)
📝 modules/context/repo.go (+4 -0)

📄 Description

Only mark a repo as bare if commits are pushed to it, as opposed to if only tags are pushed. Fixes https://github.com/go-gitea/gitea/issues/1706

Also add a sanity check to RepoRef() to avoid potential index-out-of-range error. As far as I can understand, every non-bare repo should have at least one branch, so ctx.Repo.GitRepo.GetBranches() should never actually return an empty slice, but unchecked indices make me nervous.


🔄 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/1829 **Author:** [@ethantkoenig](https://github.com/ethantkoenig) **Created:** 5/29/2017 **Status:** ✅ Merged **Merged:** 6/12/2017 **Merged by:** [@andreynering](https://github.com/andreynering) **Base:** `master` ← **Head:** `no_branches` --- ### 📝 Commits (1) - [`c85ff53`](https://github.com/go-gitea/gitea/commit/c85ff532e9154920fc2bc3f6753a805615b924dc) Commitless repos should be bare ### 📊 Changes **2 files changed** (+5 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `models/action.go` (+1 -1) 📝 `modules/context/repo.go` (+4 -0) </details> ### 📄 Description Only mark a repo as bare if commits are pushed to it, as opposed to if only tags are pushed. Fixes https://github.com/go-gitea/gitea/issues/1706 Also add a sanity check to `RepoRef()` to avoid potential index-out-of-range error. As far as I can understand, every non-bare repo should have at least one branch, so `ctx.Repo.GitRepo.GetBranches()` should never actually return an empty slice, but unchecked indices make me nervous. --- <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:01:37 -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#16070