Skip to content

fix variable assigned and not used. #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion models/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -2099,7 +2099,7 @@ func ForkRepository(u *User, oldRepo *Repository, name, desc string) (_ *Reposit
repoPath, fmt.Sprintf("ForkRepository(git update-server-info): %s", repoPath),
"git", "update-server-info")
if err != nil {
return nil, fmt.Errorf("git update-server-info: %v", err)
return nil, fmt.Errorf("git update-server-info: %v", stderr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition to print is err being not nil, so why printing stderr instead ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figured, it's just process.ExecDir in modules/process/manager.go that would need a somewhat extended documentation. All returns are in the form:

  • return "", err.Error(), err
  • return "", ErrExecTimeout.Error(), ErrExecTimeout
  • return bufOut.String(), bufErr.String(), err

where the err variable in the last case is a return from cmd.Wait (exec.ExitError) while bufErr.String() is the stderr.

So the signature of ExecDir has a duplicated return value, because the "stderr" part is always included in the "err".
I suggest ExecDir signature is changed, to reduce confusion.

}

if err = createUpdateHook(repoPath); err != nil {
Expand Down
4 changes: 0 additions & 4 deletions modules/context/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@ func RepoAssignment(args ...bool) macaron.Handler {

userName := ctx.Params(":username")
repoName := ctx.Params(":reponame")
refName := ctx.Params(":branchname")
if len(refName) == 0 {
refName = ctx.Params(":path")
}

// Check if the user is the same as the repository owner
if ctx.IsSigned && ctx.User.LowerName == strings.ToLower(userName) {
Expand Down