|
|
|
@ -402,12 +402,11 @@ func ParseCompareInfo(ctx *context.Context) *common.CompareInfo {
|
|
|
|
ci.HeadRepo = ctx.Repo.Repository
|
|
|
|
ci.HeadRepo = ctx.Repo.Repository
|
|
|
|
ci.HeadGitRepo = ctx.Repo.GitRepo
|
|
|
|
ci.HeadGitRepo = ctx.Repo.GitRepo
|
|
|
|
} else if has {
|
|
|
|
} else if has {
|
|
|
|
ci.HeadGitRepo, err = gitrepo.OpenRepository(ctx, ci.HeadRepo)
|
|
|
|
ci.HeadGitRepo, err = gitrepo.RepositoryFromRequestContextOrOpen(ctx, ci.HeadRepo)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
ctx.ServerError("OpenRepository", err)
|
|
|
|
ctx.ServerError("RepositoryFromRequestContextOrOpen", err)
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
defer ci.HeadGitRepo.Close()
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ctx.NotFound(nil)
|
|
|
|
ctx.NotFound(nil)
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
@ -726,11 +725,6 @@ func getBranchesAndTagsForRepo(ctx gocontext.Context, repo *repo_model.Repositor
|
|
|
|
// CompareDiff show different from one commit to another commit
|
|
|
|
// CompareDiff show different from one commit to another commit
|
|
|
|
func CompareDiff(ctx *context.Context) {
|
|
|
|
func CompareDiff(ctx *context.Context) {
|
|
|
|
ci := ParseCompareInfo(ctx)
|
|
|
|
ci := ParseCompareInfo(ctx)
|
|
|
|
defer func() {
|
|
|
|
|
|
|
|
if ci != nil && ci.HeadGitRepo != nil {
|
|
|
|
|
|
|
|
ci.HeadGitRepo.Close()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
if ctx.Written() {
|
|
|
|
if ctx.Written() {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|