mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Fix bare repo bug
This commit is contained in:
		
							
								
								
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							@@ -17,7 +17,7 @@ import (
 | 
			
		||||
	"github.com/gogits/gogs/modules/setting"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const APP_VER = "0.4.7.0802 Alpha"
 | 
			
		||||
const APP_VER = "0.4.7.0805 Alpha"
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	runtime.GOMAXPROCS(runtime.NumCPU())
 | 
			
		||||
 
 | 
			
		||||
@@ -446,7 +446,9 @@ func initRepository(f string, u *User, repo *Repository, initReadme bool, repoLa
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(fileName) == 0 {
 | 
			
		||||
		return nil
 | 
			
		||||
		repo.IsBare = true
 | 
			
		||||
		repo.DefaultBranch = "master"
 | 
			
		||||
		return UpdateRepository(repo)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Apply changes and commit.
 | 
			
		||||
@@ -479,10 +481,6 @@ func CreateRepository(u *User, name, desc, lang, license string, private, mirror
 | 
			
		||||
		LowerName:   strings.ToLower(name),
 | 
			
		||||
		Description: desc,
 | 
			
		||||
		IsPrivate:   private,
 | 
			
		||||
		IsBare:      lang == "" && license == "" && !initReadme,
 | 
			
		||||
	}
 | 
			
		||||
	if !repo.IsBare {
 | 
			
		||||
		repo.DefaultBranch = "master"
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if _, err = sess.Insert(repo); err != nil {
 | 
			
		||||
@@ -550,11 +548,11 @@ func CreateRepository(u *User, name, desc, lang, license string, private, mirror
 | 
			
		||||
	if u.IsOrganization() {
 | 
			
		||||
		ous, err := GetOrgUsersByOrgId(u.Id)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			log.Error(4, "repo.CreateRepository(GetOrgUsersByOrgId): %v", err)
 | 
			
		||||
			log.Error(4, "GetOrgUsersByOrgId: %v", err)
 | 
			
		||||
		} else {
 | 
			
		||||
			for _, ou := range ous {
 | 
			
		||||
				if err = WatchRepo(ou.Uid, repo.Id, true); err != nil {
 | 
			
		||||
					log.Error(4, "repo.CreateRepository(WatchRepo): %v", err)
 | 
			
		||||
					log.Error(4, "WatchRepo: %v", err)
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -245,8 +245,6 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
 | 
			
		||||
			ctx.Data["CommitsCount"] = ctx.Repo.CommitsCount
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		log.Debug("displayBare: %v; IsBare: %v", displayBare, ctx.Repo.Repository.IsBare)
 | 
			
		||||
 | 
			
		||||
		// repo is bare and display enable
 | 
			
		||||
		if displayBare && ctx.Repo.Repository.IsBare {
 | 
			
		||||
			log.Debug("Bare repository: %s", ctx.Repo.RepoLink)
 | 
			
		||||
 
 | 
			
		||||
@@ -190,7 +190,7 @@ img.avatar-30 {
 | 
			
		||||
}
 | 
			
		||||
.markdown {
 | 
			
		||||
  background-color: white;
 | 
			
		||||
  font-size: 14px;
 | 
			
		||||
  font-size: 16px;
 | 
			
		||||
  line-height: 24px;
 | 
			
		||||
}
 | 
			
		||||
.markdown .markdown-body {
 | 
			
		||||
@@ -234,10 +234,10 @@ img.avatar-30 {
 | 
			
		||||
  font-size: 18px;
 | 
			
		||||
}
 | 
			
		||||
.markdown h5 {
 | 
			
		||||
  font-size: 14px;
 | 
			
		||||
  font-size: 1em;
 | 
			
		||||
}
 | 
			
		||||
.markdown h6 {
 | 
			
		||||
  font-size: 14px;
 | 
			
		||||
  font-size: 1em;
 | 
			
		||||
}
 | 
			
		||||
.markdown table {
 | 
			
		||||
  border-collapse: collapse;
 | 
			
		||||
@@ -262,6 +262,9 @@ img.avatar-30 {
 | 
			
		||||
.markdown table tr:nth-child(2n) {
 | 
			
		||||
  background-color: #f8f8f8;
 | 
			
		||||
}
 | 
			
		||||
.markdown ul {
 | 
			
		||||
  padding: 10px 0 0 15px;
 | 
			
		||||
}
 | 
			
		||||
.markdown ul li {
 | 
			
		||||
  list-style: inside;
 | 
			
		||||
}
 | 
			
		||||
@@ -289,6 +292,7 @@ img.avatar-30 {
 | 
			
		||||
  background-color: #f5f5f5;
 | 
			
		||||
}
 | 
			
		||||
.markdown > pre {
 | 
			
		||||
  font-size: 14px;
 | 
			
		||||
  line-height: 1.6;
 | 
			
		||||
  overflow: auto;
 | 
			
		||||
  border: 1px solid #ddd;
 | 
			
		||||
@@ -346,6 +350,7 @@ img.avatar-30 {
 | 
			
		||||
  margin-bottom: 0;
 | 
			
		||||
}
 | 
			
		||||
.markdown img {
 | 
			
		||||
  padding: 10px 0;
 | 
			
		||||
  max-width: 100%;
 | 
			
		||||
}
 | 
			
		||||
.markdown .btn {
 | 
			
		||||
 
 | 
			
		||||
@@ -1 +1 @@
 | 
			
		||||
0.4.7.0802 Alpha
 | 
			
		||||
0.4.7.0805 Alpha
 | 
			
		||||
		Reference in New Issue
	
	Block a user