mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 12:18:26 +00:00 
			
		
		
		
	Commitless repos should be bare
This commit is contained in:
		| @@ -517,7 +517,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// Change repository bare status and update last updated time. | 	// Change repository bare status and update last updated time. | ||||||
| 	repo.IsBare = false | 	repo.IsBare = repo.IsBare && opts.Commits.Len <= 0 | ||||||
| 	if err = UpdateRepository(repo, false); err != nil { | 	if err = UpdateRepository(repo, false); err != nil { | ||||||
| 		return fmt.Errorf("UpdateRepository: %v", err) | 		return fmt.Errorf("UpdateRepository: %v", err) | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -392,6 +392,10 @@ func RepoRef() macaron.Handler { | |||||||
| 				if err != nil { | 				if err != nil { | ||||||
| 					ctx.Handle(500, "GetBranches", err) | 					ctx.Handle(500, "GetBranches", err) | ||||||
| 					return | 					return | ||||||
|  | 				} else if len(brs) == 0 { | ||||||
|  | 					err = fmt.Errorf("No branches in non-bare repository %s", | ||||||
|  | 						ctx.Repo.GitRepo.Path) | ||||||
|  | 					ctx.Handle(500, "GetBranches", err) | ||||||
| 				} | 				} | ||||||
| 				refName = brs[0] | 				refName = brs[0] | ||||||
| 			} | 			} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user