Browse Source

#1544 better tmp dir name for creating repo

pull/1524/merge
Unknwon 9 years ago
parent
commit
a7ee654646
  1. 5
      models/action.go
  2. 4
      models/repo.go

5
models/action.go

@ -226,6 +226,7 @@ func updateIssuesCommit(u *User, repo *Repository, repoUserName, repoName string
} }
refMarked = make(map[int64]bool) refMarked = make(map[int64]bool)
// FIXME: can merge this one and next one to a common function.
for _, ref := range IssueCloseKeywordsPat.FindAllString(c.Message, -1) { for _, ref := range IssueCloseKeywordsPat.FindAllString(c.Message, -1) {
ref = ref[strings.IndexByte(ref, byte(' '))+1:] ref = ref[strings.IndexByte(ref, byte(' '))+1:]
ref = strings.TrimRightFunc(ref, issueIndexTrimRight) ref = strings.TrimRightFunc(ref, issueIndexTrimRight)
@ -237,7 +238,7 @@ func updateIssuesCommit(u *User, repo *Repository, repoUserName, repoName string
// Add repo name if missing // Add repo name if missing
if ref[0] == '#' { if ref[0] == '#' {
ref = fmt.Sprintf("%s/%s%s", repoUserName, repoName, ref) ref = fmt.Sprintf("%s/%s%s", repoUserName, repoName, ref)
} else if strings.Contains(ref, "/") == false { } else if !strings.Contains(ref, "/") {
// We don't support User#ID syntax yet // We don't support User#ID syntax yet
// return ErrNotImplemented // return ErrNotImplemented
continue continue
@ -274,7 +275,7 @@ func updateIssuesCommit(u *User, repo *Repository, repoUserName, repoName string
// Add repo name if missing // Add repo name if missing
if ref[0] == '#' { if ref[0] == '#' {
ref = fmt.Sprintf("%s/%s%s", repoUserName, repoName, ref) ref = fmt.Sprintf("%s/%s%s", repoUserName, repoName, ref)
} else if strings.Contains(ref, "/") == false { } else if !strings.Contains(ref, "/") {
// We don't support User#ID syntax yet // We don't support User#ID syntax yet
// return ErrNotImplemented // return ErrNotImplemented
continue continue

4
models/repo.go

@ -610,8 +610,8 @@ func initRepository(e Engine, repoPath string, u *User, repo *Repository, opts C
return err return err
} }
tmpDir := filepath.Join(os.TempDir(), "gogs", repo.Name, com.ToStr(time.Now().Nanosecond())) tmpDir := filepath.Join(os.TempDir(), "gogs-"+repo.Name+"-"+com.ToStr(time.Now().Nanosecond()))
fmt.Println(tmpDir)
// Initialize repository according to user's choice. // Initialize repository according to user's choice.
if opts.AutoInit { if opts.AutoInit {
os.MkdirAll(tmpDir, os.ModePerm) os.MkdirAll(tmpDir, os.ModePerm)

Loading…
Cancel
Save