`tea pr checkout`: dont create local branches #314

Merged
lunny merged 8 commits from noerw/tea:checkout-use-remote-tracking-branch into master 2 months ago
noerw commented 4 months ago

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

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
noerw added the
kind/enhancement
status/needs-feedback
labels 4 months ago
noerw added 1 commit 4 months ago
750f8fa43e
dont create local branch for remotes
Collaborator

can we add a flag to let tea do, what normaly would be only suggested?
"-b to create the branch ..." ?

can we add a flag to let tea do, what normaly would be only suggested? "`-b` to create the branch ..." ?
noerw added 1 commit 4 months ago
Owner

can we add a flag to let tea do, what normaly would be only suggested?
"-b to create the branch ..." ?

I like the idea. If the -b is given, use that.

> can we add a flag to let tea do, what normaly would be only suggested? > "`-b` to create the branch ..." ? I like the idea. If the `-b` is given, use that.
noerw added 1 commit 4 months ago
Poster

added the --branch / -b boolean flag. providing a branch name is not supported, as then the case of using the default branch name would be quite awkward:

# this is not supported
tea pr checkout -b "foobar" 314 # checkout to localbranch "foobar"
tea pr checkout -b "" 314       # checkout to default branch name ("pulls/<idx>-<head-branch-name>")
added the `--branch` / `-b` **boolean** flag. providing a branch name is not supported, as then the case of using the default branch name would be quite awkward: ``` # this is not supported tea pr checkout -b "foobar" 314 # checkout to localbranch "foobar" tea pr checkout -b "" 314 # checkout to default branch name ("pulls/<idx>-<head-branch-name>") ```
noerw added 1 commit 4 months ago
6543 reviewed 4 months ago
Dismissed
modules/task/pull_checkout.go Outdated
"fmt"
"code.gitea.io/tea/modules/config"
"code.gitea.io/tea/modules/context"
6543 commented 4 months ago
Poster
Collaborator

unessesary adding context into task

unessesary adding context into task
6543 marked this conversation as resolved
Collaborator

i thing it still should be a boolean flag not a string ...

in the case a branch with same name exist but it is not the same one it should simply fail with a meningfull error

i thing it still should be a boolean flag not a string ... in the case a branch with same name exist but it is not the same one it should simply fail with a meningfull error
noerw added 1 commit 4 months ago
6543 added 1 commit 4 months ago
noerw added
status/needs-reviews
and removed
status/needs-feedback
labels 2 months ago
noerw added 1 commit 2 months ago
noerw added 1 commit 2 months ago
2d2c6e5088
code review
6543 approved these changes 2 months ago
Dismissed
lunny approved these changes 2 months ago
Dismissed
lunny merged commit e96cfdbbe7 into master 2 months ago
noerw deleted branch checkout-use-remote-tracking-branch 2 months ago
6543 removed the
status/needs-reviews
label 2 months ago
6543 added this to the v0.7.0 milestone 2 months ago
continuous-integration/drone/pr Build is passing
The pull request has been merged as e96cfdbbe7.
Sign in to join this conversation.
Loading…
There is no content yet.