Tyler McGoffin
e4f0b79173
Surface and handle error from ReadBranchConfig in parseCurrentBranch
...
I've only added the one test for parseCurrentBranch because the function
appears to be largely exercised by TestFind. There's definitely an
opportunity for a bigger refactor of the tests, here, but I want to avoid
scope creep as I propagate the ReadBranchConfig api changes throughout the
codebase
2025-01-09 12:46:55 -08:00
Tyler McGoffin
e4320ccc4b
Directly stub headBranchConfig in Test_tryDetermineTrackingRef
2025-01-09 11:58:33 -08:00
Tyler McGoffin
48d45d0b9d
Refactor error handling in ReadBranchConfig to avoid panic
2025-01-09 11:45:45 -08:00
Tyler McGoffin
e1423cdbbf
Refine error handling of ReadBranchConfig
...
cmd.Output() will return an error when the git command ran successfully
but had no output. To handle this, we can check Stderr, as we expect it to
be populated for any ExitErrors or otherwise when there is a command
failure.
This allows for propagation of this error handling up the call chain, so
we are now returning errors if the call to git fails instead of just
handing off an empty BranchConfig and suppressing the errors.
Additionally, I've removed some more naked returns that I found in
pkg/cmd/pr/create.go createRun
2025-01-09 11:45:15 -08:00
Tyler McGoffin
d4f7576e8b
Add test for empty BranchConfig in prSelectorForCurrentBranch
2025-01-09 09:01:14 -08:00
Tyler McGoffin
15ac566222
Remove shadowed errors from prSelectorForCurrentBranch and cover with tests
2025-01-08 15:21:05 -08:00
Tyler McGoffin
94b2d4ec3b
Added tests to cover prSelectorForCurrentBranch for confidence in refactor
2025-01-08 15:00:38 -08:00
Tyler McGoffin
ec9eaef048
Refactor prSelectorForCurrentBranch and tests
...
Replace the git config argument in prSelectorForCurrentBranch with
the branchConfig it was used to fetch. The tests needed to be refactored
accordingly to support this change to the prSelectorForCurrentBranch API.
In addition, I've moved the test to a table test format so I can expand
the test coverage in the next commit.
2025-01-08 14:34:49 -08:00
Tyler McGoffin
527d1db298
Add missing test for RemoteURL in parseBranchConfig
2025-01-08 14:24:20 -08:00
Tyler McGoffin
fea46c0011
Change ReadBranchConfig error message in gh pr create
2025-01-08 11:40:42 -08:00
Tyler McGoffin
4575692ebf
Remove private readBranchConfig method and remove parseBranchConfig from Client
...
I think I went too far with my previous refactor and am backing out of it.
Adding a private readBranchConfig method on the client wasn't providing
any real additional value, so I've put it back into ReadBranchConfig.
However, I think there is still value in having parseBranchConfig
(formerly createBranchConfig) as a separate util function, as it both
improves readability of ReadBranchConfig and makes parsing its purpose
easier through the bespoke tests for it.
2025-01-08 10:36:45 -08:00
Tyler McGoffin
0137150848
Refactor Test_readGitBranchConfig for easier parsing
2025-01-07 14:56:27 -08:00
Tyler McGoffin
c83cf32cff
Remove named return values from prSelectorForCurrentBranch
2025-01-07 13:54:43 -08:00
Tyler McGoffin
f43da8ea9a
Refactor ReadBranchConfig for test coverage of newly returned erros
2025-01-07 13:54:43 -08:00
Tyler McGoffin
bf6fdbdfd2
Remove named returns from ReadBranchConfig and surface errors
2025-01-07 13:54:43 -08:00
Andy Feller
40984d1eb6
Merge pull request #10186 from cli/wm/clear-up-fine-grained-pats-auth-login
...
Clear up --with-token fine grained PAT usage
2025-01-06 15:24:37 -05:00
Andy Feller
b3be16e98e
Merge pull request #10190 from cli/andyfeller/go-gh-2.11.2-security-bump
...
Bump cli/go-gh for indirect security vulnerability
2025-01-06 14:38:49 -05:00
Andy Feller
757966ca7c
Bump cli/go-gh for indirect security vulnerability
2025-01-06 14:27:03 -05:00
Tyler McGoffin
1f4e005562
Merge pull request #10158 from aryanbhosale/trunk
...
fix(repo fork): add non-TTY output when fork is newly created
2025-01-06 10:11:14 -08:00
Tyler McGoffin
2358fcee83
Merge pull request #10177 from cli/cmbrose/pr-create-upstream-fix
...
Handle missing upstream configs for `gh pr create`
2025-01-06 09:32:00 -08:00
William Martin
c3b41e87b8
Panic mustParseTrackingRef if format is incorrect
2025-01-06 10:33:28 -06:00
William Martin
8b5073d617
Move trackingRef into pr create package
2025-01-06 10:33:28 -06:00
William Martin
62ecb1c84d
Make tryDetermineTrackingRef tests more respective of reality
...
Though it doesn't really matter, in practice upstream is always going to come before origin.
2025-01-06 10:33:28 -06:00
William Martin
57ba5e5608
Rework tryDetermineTrackingRef tests
2025-01-06 10:33:28 -06:00
William Martin
b8c167970b
Avoid pointer return from determineTrackingBranch
2025-01-06 10:33:28 -06:00
William Martin
27bd4b2aec
Doc determineTrackingBranch
2025-01-06 10:33:28 -06:00
William Martin
05764b8114
Don't use pointer for determineTrackingBranch branchConfig
2025-01-06 10:33:28 -06:00
William Martin
dc077dc09b
Panic if tracking ref can't be reconstructed
2025-01-06 10:33:28 -06:00
William Martin
3ae4e5da20
Document and rework pr create tracking branch lookup
2025-01-06 10:33:28 -06:00
William Martin
e7d49fb78c
Update pkg/cmd/auth/login/login.go
...
Co-authored-by: Andy Feller <andyfeller@github.com>
2025-01-06 17:21:02 +01:00
Kynan Ware
106d5d1144
Merge pull request #10181 from jsoref/issue-10084
...
Upgrade generated workflows
2025-01-06 09:08:33 -07:00
William Martin
3695bda637
Clear up --with-token fine grained PAT usage
2025-01-06 16:41:48 +01:00
Josh Soref
dd32a9cc94
Upgrade generated workflows
...
Use `cli/gh-extension-precompile@v2`
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2025-01-05 23:18:28 -05:00
Aryan Bhosale
3fe6ba4e8e
Merge branch 'trunk' into trunk
2025-01-04 10:24:07 +05:30
Aryan Bhosale
c7d444d65b
Merge pull request #1 from cli/jtmcg/fix-tests-10158
...
Fixed test for stdout in non-tty use case of repo fork
2025-01-04 10:22:32 +05:30
Tyler McGoffin
2ec473ff2f
Merge pull request #10139 from ChandranshuRao14/feat/repo-edit-security-analysis
...
Feat: Allow setting security_and_analysis settings in gh repo edit
2025-01-03 16:22:10 -08:00
Tyler McGoffin
efec5d9250
Fixed test for stdout in non-tty use case of repo fork
2025-01-03 15:54:07 -08:00
Caleb Brose
67749480d5
Fix test
2025-01-03 20:45:20 +00:00
Caleb Brose
9d490547b8
Alternative: remove LocalBranch from BranchConfig
2025-01-03 20:39:12 +00:00
Caleb Brose
7a1052ca33
Set LocalBranch even if the git config fails
2025-01-03 20:35:48 +00:00
Tyler McGoffin
576fa8a3bc
Add test for permissions check for security and analysis edits ( #1 )
2025-01-03 01:29:45 -05:00
Aryan Bhosale
8dbbceaaaf
print repo url to stdout
2025-01-03 10:54:30 +05:30
Tyler McGoffin
d6dba93586
Merge pull request #10164 from cli/jtmcg/update-auth-PAT-info
...
Add mention of classic token in gh auth login docs
2025-01-02 15:29:23 -08:00
Tyler McGoffin
2306623cad
Merge pull request #10124 from hoffm/autolink-references
...
feat: Add support for listing autolink references
2025-01-02 14:29:48 -08:00
Tyler McGoffin
aa793f1dac
Update pkg/cmd/auth/login/login.go
...
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
2025-01-02 14:22:20 -08:00
Tyler McGoffin
ae9e68b803
Move mention of classic token to correct line
2025-01-02 10:41:25 -08:00
Michael Hoffman
a5cf3751cd
Separate type decrarations
2025-01-02 13:14:23 -05:00
Michael Hoffman
8f00cd40af
Merge branch 'cli:trunk' into autolink-references
2025-01-02 13:11:48 -05:00
Tyler McGoffin
375dbf19da
Add mention of classic token in gh auth login docs
2025-01-02 10:08:28 -08:00
Kynan Ware
64c23e5e95
Merge pull request #10163 from nobe4/repo-create-branch-doc
...
docs(repo): make explicit which branch is used when creating a repo
2025-01-02 09:34:21 -07:00