Skip to content

Commit

Permalink
[#21] (mr checkout) properly fetch MR ref to branchname
Browse files Browse the repository at this point in the history
  • Loading branch information
zaquestion committed Oct 6, 2017
1 parent 21e39e6 commit 50ee1ca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ lab will look for hub and uses that as your git binary when available so you don
$ lab version
git version 2.11.0
hub version 2.3.0-pre9
lab version 0.1.0-alpha
lab version 0.3.1
```

# Inspiration
Expand All @@ -34,7 +34,7 @@ $ go get github.com/zaquestion/lab
$ lab version
git version 2.11.0
lab version 0.1.0-alpha
lab version 0.3.1
```

The first time you run lab it will prompt for your GitLab information. All configuration is managed through `git config` so don't worry if you mess it up. Keys can be set at the system, global, or local level.
Expand Down
3 changes: 2 additions & 1 deletion cmd/mrCheckout.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ var checkoutCmd = &cobra.Command{
fmt.Printf("MR #%s not found\n", mrIDStr)
return
}
// https://docs.gitlab.com/ee/user/project/merge_requests/#checkout-merge-requests-locally
branch := mrs[0].SourceBranch
mr := fmt.Sprintf("refs/merge-requests/%s/head", mrIDStr)
gitf := git.New("fetch", targetRemote, mr, fmt.Sprintf(":%s", branch))
gitf := git.New("fetch", targetRemote, fmt.Sprintf("%s:%s", mr, branch))
err = gitf.Run()
if err != nil {
log.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var versionCmd = &cobra.Command{
git.Stdout = nil
git.Stderr = nil
version, _ := git.Output()
fmt.Printf("%s%s\n", string(version), "lab version 0.3.0")
fmt.Printf("%s%s\n", string(version), "lab version 0.3.1")
},
}

Expand Down

0 comments on commit 50ee1ca

Please sign in to comment.