"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "modules/repository/create.go" between
gitea-1.13.1.tar.gz and gitea-1.13.2.tar.gz

About: Gitea allows to set up a self-hosted code hosting Git service (a fork of Gogs).

create.go  (gitea-1.13.1):create.go  (gitea-1.13.2)
skipping to change at line 32 skipping to change at line 32
if !doer.IsAdmin && !u.CanCreateRepo() { if !doer.IsAdmin && !u.CanCreateRepo() {
return nil, models.ErrReachLimitOfRepo{ return nil, models.ErrReachLimitOfRepo{
Limit: u.MaxRepoCreation, Limit: u.MaxRepoCreation,
} }
} }
if len(opts.DefaultBranch) == 0 { if len(opts.DefaultBranch) == 0 {
opts.DefaultBranch = setting.Repository.DefaultBranch opts.DefaultBranch = setting.Repository.DefaultBranch
} }
// Check if label template exist
if len(opts.IssueLabels) > 0 {
if _, err := models.GetLabelTemplateFile(opts.IssueLabels); err !
= nil {
return nil, err
}
}
repo := &models.Repository{ repo := &models.Repository{
OwnerID: u.ID, OwnerID: u.ID,
Owner: u, Owner: u,
OwnerName: u.Name, OwnerName: u.Name,
Name: opts.Name, Name: opts.Name,
LowerName: strings.ToLower(opts.Name), LowerName: strings.ToLower(opts.Name),
Description: opts.Description, Description: opts.Description,
OriginalURL: opts.OriginalURL, OriginalURL: opts.OriginalURL,
OriginalServiceType: opts.GitServiceType, OriginalServiceType: opts.GitServiceType,
IsPrivate: opts.IsPrivate, IsPrivate: opts.IsPrivate,
IsFsckEnabled: !opts.IsMirror, IsFsckEnabled: !opts.IsMirror,
IsTemplate: opts.IsTemplate, IsTemplate: opts.IsTemplate,
CloseIssuesViaCommitInAnyBranch: setting.Repository.DefaultCloseI ssuesViaCommitsInAnyBranch, CloseIssuesViaCommitInAnyBranch: setting.Repository.DefaultCloseI ssuesViaCommitsInAnyBranch,
Status: opts.Status, Status: opts.Status,
IsEmpty: !opts.AutoInit, IsEmpty: !opts.AutoInit,
TrustModel: opts.TrustModel, TrustModel: opts.TrustModel,
} }
var rollbackRepo *models.Repository
if err := models.WithTx(func(ctx models.DBContext) error { if err := models.WithTx(func(ctx models.DBContext) error {
if err := models.CreateRepository(ctx, doer, u, repo, false); err != nil { if err := models.CreateRepository(ctx, doer, u, repo, false); err != nil {
return err return err
} }
// No need for init mirror. // No need for init mirror.
if opts.IsMirror { if opts.IsMirror {
return nil return nil
} }
skipping to change at line 88 skipping to change at line 97
log.Error("initRepository: %v", err) log.Error("initRepository: %v", err)
return fmt.Errorf( return fmt.Errorf(
"delete repo directory %s/%s failed(2): % v", u.Name, repo.Name, err2) "delete repo directory %s/%s failed(2): % v", u.Name, repo.Name, err2)
} }
return fmt.Errorf("initRepository: %v", err) return fmt.Errorf("initRepository: %v", err)
} }
// Initialize Issue Labels if selected // Initialize Issue Labels if selected
if len(opts.IssueLabels) > 0 { if len(opts.IssueLabels) > 0 {
if err := models.InitializeLabels(ctx, repo.ID, opts.Issu eLabels, false); err != nil { if err := models.InitializeLabels(ctx, repo.ID, opts.Issu eLabels, false); err != nil {
if errDelete := models.DeleteRepository(doer, u.I rollbackRepo = repo
D, repo.ID); errDelete != nil { rollbackRepo.OwnerID = u.ID
log.Error("Rollback deleteRepository: %v"
, errDelete)
}
return fmt.Errorf("InitializeLabels: %v", err) return fmt.Errorf("InitializeLabels: %v", err)
} }
} }
if stdout, err := git.NewCommand("update-server-info"). if stdout, err := git.NewCommand("update-server-info").
SetDescription(fmt.Sprintf("CreateRepository(git update-s erver-info): %s", repoPath)). SetDescription(fmt.Sprintf("CreateRepository(git update-s erver-info): %s", repoPath)).
RunInDir(repoPath); err != nil { RunInDir(repoPath); err != nil {
log.Error("CreateRepository(git update-server-info) in %v : Stdout: %s\nError: %v", repo, stdout, err) log.Error("CreateRepository(git update-server-info) in %v : Stdout: %s\nError: %v", repo, stdout, err)
if errDelete := models.DeleteRepository(doer, u.ID, repo. rollbackRepo = repo
ID); errDelete != nil { rollbackRepo.OwnerID = u.ID
log.Error("Rollback deleteRepository: %v", errDel
ete)
}
return fmt.Errorf("CreateRepository(git update-server-inf o): %v", err) return fmt.Errorf("CreateRepository(git update-server-inf o): %v", err)
} }
return nil return nil
}); err != nil { }); err != nil {
if rollbackRepo != nil {
if errDelete := models.DeleteRepository(doer, rollbackRep
o.OwnerID, rollbackRepo.ID); errDelete != nil {
log.Error("Rollback deleteRepository: %v", errDel
ete)
}
}
return nil, err return nil, err
} }
return repo, nil return repo, nil
} }
 End of changes. 5 change blocks. 
10 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)