Theoretically this should be clearer and more robust than the previous
version which had some custom loop logic while trying to parse newlines
and determine whether it had reached a new commit entry by trying to parse
a git sha. This would not have worked correctly if a commit body contained
a sha on a new line.
Since this is guarded by the line starting with a git sha, it must
be a line of the form 'sha,title,body', so there can never be only
two entries since the Split fn will produce an empty string in the
last spot in the case of a missing body.
This is used to fill the body of PR with all commits msg + body
of every commits because there can be lot of useful information.
Signed-off-by: Federico Guerinoni <guerinoni.federico@gmail.com>
Before, git client was not correctly setting `ErrNotOnAnyBranch` error.
Because of that, `gh pr status` was not functioning correctly when run
from the detached HEAD. This commit fixes that.
Fixes#7051
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.
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>
* 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>
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.
* 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>