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