No reviewers
Labels
No Label
kind/breaking
kind/bug
kind/build
kind/dependency
kind/deployment
kind/docs
kind
enhancement
kind
feature
kind/proposal
kind
question
kind
refactor
kind/security
kind/testing
kind/translation
priority/critical
priority/high
priority/low
priority/medium
reviewed/duplicate
reviewed/invalid
reviewed/wontfix
skip-changelog
status/blocked
status/has-backport
status/has-pull
status/needs-backport
status/needs-feedback
status/needs-reviews
status/wip
upstream/gitea
upstream/sdk
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitea/tea#105
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "noerw/tea:issue-97/pulls-clean"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
fixes #93, #97, #107
@ -73,0 +174,4 @@
if err != nil {
return err
}
if pr.State == gitea.StateOpen {
User may still want to clean it, but we can give a confirmation.
But we can't safely remove the remote branch in this case, right?
Effectively tea wouldn't do anything different than
git branch -D <featurebranch>
, so I don't see the point.We could guide the user to call
tea pulls close 1
first if he really wants to, thats more expressive than a--force
flag@ -0,0 +1,107 @@
package git
copyright head.
I encountered an panic when I input
tea pr clean 7
on xorm/reverse#7.add `tea pulls clean` command (#97)to add `tea pulls [checkout | clean]` commands (#93 #97 #107)@lunny There were flaws in the way I looked up branches, should be fixed now among other problems.
@ -62,3 +55,1 @@
return err
}
idx, err := argToIndex(index)
no err check
thanks, resolved
@ -14,3 +19,3 @@
)
// CmdPulls represents to login a gitea server.
// CmdPulls is the main command to operate on PRs
good catch!
@ -91,0 +134,4 @@
}
// verify related remote is in local repo, otherwise add it
newRemoteName := fmt.Sprintf("pulls/%v", pr.Head.Repository.Owner.UserName)
future impruvement: define prefix via config ... (for examle i sue
user/
)but this can be added after this pull :)
@ -91,0 +202,4 @@
return fmt.Errorf("PR is still open, won't delete branches")
}
// check if the feature branch is ours:
can you move L205-207 too current 213 ...?
a few questions ... but looks good
@ -0,0 +20,4 @@
localBranchRefName := git_plumbing.NewBranchReferenceName(localBranchName)
err := r.CreateBranch(&git_config.Branch{
Name: localBranchName,
Merge: git_plumbing.NewBranchReferenceName(remoteBranchName), // FIXME: should be remoteBranchName
Whats the meaning of the FIXME?
Panic is gone, but it reported no authentication but in fact when I input
tea issues
, there are content listed.@lunny Interesting. I guess you use a
https
remote? For SSH it worked fine.I'm not sure how one would safely provide interactive authentication for https.
When developing, I noted that in pushing/pulling you can provide an
AuthMethod
, for which I found no further documentation though, so I'd need help hereWe should care that the head branch maybe in the forked repsitory and a non-origin remote.
You mean that we should not clean on remotes that are not
origin
, as the user might have no write permission? Whitelisting onlyorigin
is too strict (i use origin as upstream andnoerw
for my fork).I guess there is is no other safe way than trying if the user may push there, and notifying that the remote branch deletion failed
a realy nice to have featur ... but I hit an bug
@6543 could you post the result of the following command? I suspect your SSH agent is not set up correctly, which wouldn't really be a bug in
tea
.This vars are not set at all
EDIT: so it need a ssh agent running in the background :/
if I start ssh-agent and export this vars I get this:
Seems like it selects the wrong key.
I could specify a key to use in
repo.Push()
. Then no ssh-agent is needed, but the default key~/.ssh/id_rsa
will not always be the right one.Instead we could add a config option for a login to specify an ssh key, defaulting to
id_rsa
.@noerw why not fallback -> use ssh-agent and if not afailable fall back to configurable ssh key witch by default use
~/.ssh/id_rsa
or is this to mouch?if so I'm for reading the key direct
@6543 I added authentication for https & ssh (trying ssh-agent, and then falling back to reading a key manually), so it should work for your setup now as well.
(Logins now store username & path to ssh key, both config values are optional)
Edit:
It seems like gitea does not support Token Auth for git pushes over https? If it does (I couldn't get it to work), one could use the tea token instead of prompting users for credentials
@noerw It asks for authentification on checkout for a https conection every time
had this issue only on a single repo - if it happen's again I will debug it cant find any issues - thanks @noerw this subcomand is a huge help (testing this branch since 1w 👍 )
@noerw can you "update" this pull ?