Commit graph

138 commits

Author SHA1 Message Date
Mislav Marohnić
8df1e9946f
repo set-default: support bare git repos
The command was using this to check for git repo context:

    git rev-parse --is-inside-work-tree

With this change, this is used instead:

    git rev-parse --git-dir

The latter approach works in the context of a bare git repository, which does not have a worktree.
2023-01-18 20:45:12 +01:00
Nate Smith
941dc26cc8
Update git/client.go
Co-authored-by: Sam Coe <samcoe@users.noreply.github.com>
2022-12-14 16:15:37 -08:00
vilmibm
76c58930d9 tests pass 2022-12-13 10:48:03 -08:00
vilmibm
7e3e2d96a8 Merge remote-tracking branch 'origin/trunk' into base-cmd 2022-12-13 10:39:40 -08:00
Sam Coe
98ab1f2587
Authenticate network git commands (#6541) 2022-11-15 13:14:37 +02:00
Sam Coe
6bbfc5056d
Use git client in extension manager (#6547) 2022-11-10 11:38:12 +02:00
Sam Coe
f96b2fce57
Refactor git client and add tests (#6525) 2022-11-03 11:58:38 +01:00
Sam Coe
4294ee14a1
revert revert 57fbe4f317 (#6474) 2022-10-20 12:17:20 +00:00
Sam Coe
2cefb9fa59
Fix pr create regression (#6472)
* Revert "Refactor to use new git client (#6447)"

This reverts commit 57fbe4f317.

* Fix pr create regression
2022-10-20 12:46:23 +03:00
Sam Coe
57fbe4f317
Refactor to use new git client (#6447) 2022-10-19 21:11:36 +03:00
tdakkota
d41efa7a6a
Fix #6452 (#6453) 2022-10-18 06:36:52 +00:00
Sam Coe
2944f7c3ab
Create git client (#6354) 2022-10-14 07:47:03 +00:00
Eng Zer Jun
471cbea4fa
test: use t.Setenv to set env vars in tests (#6333)
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-09-26 08:46:02 +00:00
Mislav Marohnić
6ca9406554 pr create: allow git push step to prompt on stdin 2022-09-21 20:57:53 +02:00
Sam Coe
743a747804
Use go-gh for SSH hostname alias translation (#5654) 2022-06-08 21:32:29 +00:00
Ahmed Adan
31bee2e639
Add --upstream-remote-name flag to gh replo clone (#5619) 2022-05-24 13:12:01 +02:00
Sam Coe
22a5d2abf8
Refactor code to live inside default pkg 2022-05-18 08:40:30 +02:00
bchadwic
66a69bdec5
fixing lint and formatting 2022-05-18 08:40:29 +02:00
bchadwic
86658513b1
Created more test cases, added in env section 2022-05-18 08:40:29 +02:00
bchadwic
ca5e9a49b5
thinking of a better solution, wip. BaseRepo() might be better split up 2022-05-18 08:40:29 +02:00
bchadwic
a98395f4e8
headed in the right direction. Needs tests and to be cleaned up. This is a working example of the teams design combined with https://github.com/cli/cli/pull/4859#issuecomment-1012776582 2022-05-18 08:40:29 +02:00
bchadwic
38097e8cad
created gh config base a way to configure the base repo 2022-05-18 08:40:28 +02:00
Boston Cartwright
bb9bf29835
pr merge switch to base branch if available (#5251)
* after merge, switch to base branch if available

* Add ability to checkout new branch

* Style cleanup

Co-authored-by: Sam Coe <samcoe@users.noreply.github.com>
2022-03-14 14:02:57 +02:00
Mislav Marohnić
c240ab9137 Unconditionally resolve "ssh.github.com" to "github.com"
Previously, only "github.com" mapped to "ssh.github.com" via ssh config
was treated as "github.com". Now, any "ssh.github.com" host is treated
as "github.com", even if it was initially aliased as something else in
the user's ssh hostname mappings.
2021-12-20 16:09:46 +01:00
Parth
c987c5711d
pr merge: pull after switching branches (#4748) 2021-11-29 18:26:35 +01:00
Nate Smith
b5d90e1204
Merge pull request #4588 from cli/bin-ext-migrate
binary extension migration
2021-11-17 13:22:28 -06:00
Meijke
0a0a358168
rewrite gh repo create (#4578)
Co-authored-by: Parth Patel <ppatil91099@gmail.com>
2021-11-17 20:16:37 +01:00
nate smith
54b82dd072 Migrate to binary style extensions when detected 2021-11-17 13:15:04 -06:00
Parth Patel
8e72d48e72 Merge branch 'trunk' into repo-rename 2021-10-20 16:16:31 -04:00
Parth Patel
dd87e80b4c added final touches 2021-10-20 16:12:32 -04:00
Parth Patel
ddd0b7cb04 added remote update 2021-10-18 16:43:40 -04:00
nate smith
4996ba2ba4 Merge remote-tracking branch 'origin/trunk' into relative-path 2021-10-14 12:24:27 -05:00
Marwan Sulaiman
b9bdef2b00
Add org scoped port forwarding + fix test formatting (#4497)
* Add org scoped port forwarding + fix test formatting

* Redesign port visibility

* Update pkg/cmd/codespace/ports.go

Co-authored-by: Jose Garcia <josebalius@github.com>

* Change sub command to privacy

* Example pr comment

* Fix test mock

* Fix test mock

Co-authored-by: Jose Garcia <josebalius@github.com>
2021-10-13 13:56:03 -04:00
Dan Burzo
9f43967042 Fixes #4346: allow git+https URL protocol 2021-09-20 19:35:06 +03:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Mislav Marohnić
21521b06b9 Check git presence during auth login only if it's going to be needed 2021-08-11 19:22:16 +02:00
bchadwic
8469441464 new functionality: current folder './', parent folder '../', absolute 'filename' 2021-07-25 23:53:27 -07:00
bchadwic
b3a24d273b cleaned up git.go, browse_test.go, and browse.go 2021-07-16 00:07:04 -07:00
bchadwic
25a35a6e88 added relative path access in gh browse 2021-07-15 23:38:54 -07:00
Mislav Marohnić
492f45422e Add a note about the style of git tests 2021-02-26 13:07:38 +01:00
Mislav Marohnić
d97e8fe172 Add live tests for some methods in the git package
We relied too much on stubs for these methods. These new tests actually
invoke `git` commands in the context of a test repository.
2021-02-24 15:05:56 +01:00
Mislav Marohnić
0f85304e3e Avoid crash in pr merge when verifying whether a PR had diverged
A PR is not guaranteed to have commits, it seems, so add a guard against
assuming that there is always a head commit.
2021-02-24 14:37:29 +01:00
Sam Coe
3f172ad991
Add contional and tests 2021-01-25 13:27:32 -08:00
zamasu
e4b9f7cb8c
Alert unpushed commits when merging a pull request 2021-01-25 12:04:32 -08:00
Mislav Marohnić
64fda21116 Avoid ever invoking go-homedir when config was found in a new location 2021-01-22 20:22:32 +01:00
Matthew Gleich
7d9461b819 ♻️ Refactor to use os.UserHomeDir() 2021-01-22 18:51:28 +01:00
Mislav Marohnić
06cf2c9f81 Merge remote-tracking branch 'origin' into cmd-stub-new 2021-01-22 16:31:29 +01:00
Nate Smith
29805a4003
Merge pull request #2588 from cdce8p/gh-clone-fetch
Only fetch default branch when adding upstream remote
2021-01-21 12:57:10 -08:00
vilmibm
dcedd32249 use newer command stubbing in tests 2021-01-21 12:32:40 -08:00
Cristian Dominguez
45f4a1f087 Equal: flip arguments position 2021-01-18 21:00:59 -03:00