Add git helper #612

Open
Sirherobrine23 wants to merge 4 commits from Sirherobrine23/tea:main into main
First-time contributor

Add support to tea login with helper same another tools and gh

Add support to tea login with helper same another tools and `gh`
Sirherobrine23 added 1 commit 2023-12-09 18:47:04 +00:00
Add git helper
Add support to tea login with helper same another tools and `gh`
Co-authored-by: Matheus Sampaio Queiroga <srherobrine20@gmail.com>
Co-committed-by: Matheus Sampaio Queiroga <srherobrine20@gmail.com>
Some checks failed
check-and-test / check-and-test (pull_request) Has been cancelled
6d35e9d762
Sirherobrine23 force-pushed main from 6d35e9d762 to fea1885002 2023-12-09 19:41:19 +00:00 Compare
Sirherobrine23 force-pushed main from fea1885002 to a09ef026ae 2023-12-12 04:19:26 +00:00 Compare
Sirherobrine23 force-pushed main from a09ef026ae to 4e61504a81 2023-12-12 04:30:36 +00:00 Compare
lunny added the
kind
feature
label 2023-12-12 09:18:58 +00:00
Owner

Will this replace #599 ?

Will this replace #599 ?
Author
First-time contributor

no, it just passes the user and the token for git operations, such as push and pull for authentication, gh also does this for github authentication (gh cli helper)

no, it just passes the user and the token for git operations, such as push and pull for authentication, `gh` also does this for github authentication ([gh cli helper](https://github.com/cli/cli/blob/0f39935cc17c687232776ad4a4db2172559f2a86/pkg/cmd/auth/shared/git_credential.go#L131-L136))
Sirherobrine23 force-pushed main from 4e61504a81 to 9d506745cc 2023-12-27 13:50:18 +00:00 Compare
Owner

please resolve conflicts :)

please resolve conflicts :)
Sirherobrine23 added 1 commit 2024-02-15 17:31:05 +00:00
Merge main
Some checks failed
check-and-test / check-and-test (pull_request) Failing after 23s
1aff5b94f5
Sirherobrine23 force-pushed main from 1aff5b94f5 to 793ecfc288 2024-02-15 17:40:33 +00:00 Compare
Sirherobrine23 force-pushed main from 793ecfc288 to f1d93f21f2 2024-02-15 17:41:50 +00:00 Compare
6543 reviewed 2024-02-15 19:54:26 +00:00
@ -18,0 +22,4 @@
exec.Command("git", "config", "--global", "--unset-all", fmt.Sprintf("credential.%s.helper", login.URL)).Run()
//
_, err := exec.Command("git", "config", "--global", fmt.Sprintf("credential.%s.helper", login.URL), "").Output()
Owner

should this not be a per repo setting?

should this not be a per repo setting?
Owner

ah never mind ... it has to be a global config.

anyway I expect this setup to not delete other helpers

ah never mind ... it has to be a global config. anyway I expect this setup to not delete other helpers
Author
First-time contributor

No, only host set in configuration, if set invalid host git command exit and don't change config

No, only host set in configuration, if set invalid host git command exit and don't change config
6543 marked this conversation as resolved
6543 reviewed 2024-02-15 19:55:22 +00:00
@ -18,0 +21,4 @@
// Remove all helpers
exec.Command("git", "config", "--global", "--unset-all", fmt.Sprintf("credential.%s.helper", login.URL)).Run()
//
Owner

comment = ?!?

comment = ?!?
6543 marked this conversation as resolved
Sirherobrine23 added 1 commit 2024-02-15 20:02:28 +00:00
Update comments
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 50s
ff7b53468f
6543 reviewed 2024-02-15 20:20:30 +00:00
@ -18,0 +19,4 @@
// SetupHelper add tea helper to config global
func SetupHelper(login config.Login) error {
// Remove old helper
exec.Command("git", "config", "--global", "--unset-all", fmt.Sprintf("credential.%s.helper", login.URL)).Run()
Owner

do we have to unset-all others?!?

do we have to unset-all others?!?
Author
First-time contributor

If you run tea login helper setup, it will go through the logins and place a new helper, if you don't delete it it will keep adding the helper, in this case it deletes the other helpers, like it would look like this if you run the command 3 times:

[credential "https://gitea.com"]
	helper = 
	helper = !tea login helper
	helper = !tea login helper
	helper = !tea login helper
If you run `tea login helper setup`, it will go through the logins and place a new helper, if you don't delete it it will keep adding the helper, in this case it deletes the other helpers, like it would look like this if you run the command 3 times: ``` [credential "https://gitea.com"] helper = helper = !tea login helper helper = !tea login helper helper = !tea login helper ```
Owner

could we not just check if there exist an tea entry in this case?

could we not just check if there exist an tea entry in this case?
Sirherobrine23 marked this conversation as resolved
Sirherobrine23 added 1 commit 2024-02-16 00:07:32 +00:00
Check if tea is present in helper
Some checks failed
check-and-test / check-and-test (pull_request) Failing after 22m34s
f9dd53679a
Sirherobrine23 force-pushed main from f9dd53679a to ef9e321c76 2024-02-16 00:16:47 +00:00 Compare
Sirherobrine23 force-pushed main from ef9e321c76 to 9f90b0c053 2024-02-16 00:19:53 +00:00 Compare
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 48s
Required
Details
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u main:Sirherobrine23-main
git checkout Sirherobrine23-main
Sign in to join this conversation.
No description provided.