mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-02 18:08:30 +02:00
tea pr checkout
: dont create local branches (#314)
This avoids creation of local branches, to avoid cluttering the local repo: - if the commit already exists on the tip of a local branch, check that one out - otherwise check out the remote tracking branch (`refs/remotes/<remote>/<head>`), and suggest what to do if you want to make changes. I'm not certain this behaviour is actually better, I suggest leaving this open for a while for people to try out the new behaviour: ``` tea pr checkout 314 make install ``` fixes #293 Co-authored-by: Norwin Roosen <git@nroo.de> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/314 Reviewed-by: 6543 <6543@obermui.de> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Norwin <noerw@noreply.gitea.io> Co-committed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
@ -24,7 +24,13 @@ var CmdPullsCheckout = cli.Command{
|
||||
Description: `Locally check out the given PR`,
|
||||
Action: runPullsCheckout,
|
||||
ArgsUsage: "<pull index>",
|
||||
Flags: flags.AllDefaultFlags,
|
||||
Flags: append([]cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "branch",
|
||||
Aliases: []string{"b"},
|
||||
Usage: "Create a local branch if it doesn't exist yet",
|
||||
},
|
||||
}, flags.AllDefaultFlags...),
|
||||
}
|
||||
|
||||
func runPullsCheckout(cmd *cli.Context) error {
|
||||
@ -38,5 +44,5 @@ func runPullsCheckout(cmd *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return task.PullCheckout(ctx.Login, ctx.Owner, ctx.Repo, idx, interact.PromptPassword)
|
||||
return task.PullCheckout(ctx.Login, ctx.Owner, ctx.Repo, ctx.Bool("branch"), idx, interact.PromptPassword)
|
||||
}
|
||||
|
Reference in New Issue
Block a user