|
|
@ -101,8 +101,11 @@ func ForkPost(c *context.Context, f form.CreateRepo) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
repo, has := models.HasForkedRepo(ctxUser.ID, baseRepo.ID) |
|
|
|
repo, has, err := models.HasForkedRepo(ctxUser.ID, baseRepo.ID) |
|
|
|
if has { |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
c.ServerError("HasForkedRepo", err) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} else if has { |
|
|
|
c.Redirect(repo.Link()) |
|
|
|
c.Redirect(repo.Link()) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -119,7 +122,7 @@ func ForkPost(c *context.Context, f form.CreateRepo) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
repo, err := models.ForkRepository(c.User, ctxUser, baseRepo, f.RepoName, f.Description) |
|
|
|
repo, err = models.ForkRepository(c.User, ctxUser, baseRepo, f.RepoName, f.Description) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
c.Data["Err_RepoName"] = true |
|
|
|
c.Data["Err_RepoName"] = true |
|
|
|
switch { |
|
|
|
switch { |
|
|
@ -475,8 +478,11 @@ func ParseCompareInfo(c *context.Context) (*models.User, *models.Repository, *gi |
|
|
|
// no need to check the fork relation.
|
|
|
|
// no need to check the fork relation.
|
|
|
|
if !isSameRepo { |
|
|
|
if !isSameRepo { |
|
|
|
var has bool |
|
|
|
var has bool |
|
|
|
headRepo, has = models.HasForkedRepo(headUser.ID, baseRepo.ID) |
|
|
|
headRepo, has, err = models.HasForkedRepo(headUser.ID, baseRepo.ID) |
|
|
|
if !has { |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
c.ServerError("HasForkedRepo", err) |
|
|
|
|
|
|
|
return nil, nil, nil, nil, "", "" |
|
|
|
|
|
|
|
} else if !has { |
|
|
|
log.Trace("ParseCompareInfo [base_repo_id: %d]: does not have fork or in same repository", baseRepo.ID) |
|
|
|
log.Trace("ParseCompareInfo [base_repo_id: %d]: does not have fork or in same repository", baseRepo.ID) |
|
|
|
c.NotFound() |
|
|
|
c.NotFound() |
|
|
|
return nil, nil, nil, nil, "", "" |
|
|
|
return nil, nil, nil, nil, "", "" |
|
|
|