Tyler McGoffin
100f9b473f
Change pr number in test
2025-01-09 12:57:23 -08:00
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
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
fea46c0011
Change ReadBranchConfig error message in gh pr create
2025-01-08 11:40:42 -08:00
Tyler McGoffin
c83cf32cff
Remove named return values from prSelectorForCurrentBranch
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
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
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
Heath Stewart
78836097c3
Document how to set gh-merge-base
...
Follow-up to PR #9712
2024-12-20 10:49:38 -08:00
William Martin
d662226ae4
Name conditionals in PR finder
2024-12-13 14:33:33 +01:00
William Martin
96ac8d6a2f
Support pr view for intra-org forks
2024-12-13 14:27:41 +01:00
Kynan Ware
253b082600
Return err instead of silentError in merge queue check
2024-12-12 15:54:01 -07:00
Kynan Ware
439cfa08bb
Exit on pr merge with -d and merge queue
...
When running `gh pr merge -d` on a repo with a merge queue policy, exit before attempting to merge.
2024-12-12 14:49:38 -07:00
William Martin
54a7f4de70
Revert "Confirm auto-detected base branch"
...
This reverts commit e021a07285 .
2024-12-09 13:01:00 +01:00
Heath Stewart
e021a07285
Confirm auto-detected base branch
...
If interactive, confirm the automatically configured gh-merge-branch or, if not configured, the default branch.
Based on PR feedback.
2024-12-08 22:27:00 -08:00
Heath Stewart
5da86e07e7
Merge changes from #10004
...
Merges changes from @williammartin including acceptance tests and word changes.
Co-authored-by: William Martin <williammartin@github.com>
2024-12-08 20:34:21 -08:00
Heath Stewart
3d139019f8
Open PR against gh-merge-base
...
Partly resolves issue #8979 by checking for a `gh-merge-base` branch tag and using that as though it were passed to `gh pr create --base`.
2024-12-08 17:40:00 -08:00
Andy Feller
c9ecf310b3
Error for mutually exclusive json and watch flags
...
Closes #10013
This commit enhances `gh pr checks` to exit with an error when mutually exclusive `--json` and `--watch` flags are used. Users are encouraged to either 1) retrieve information about the checks via `--json` or 2) watch and wait on PR checks that are being updated.
2024-12-05 10:23:13 -05:00
William Martin
694e565384
Fix PR checkout panic when base repo is not in remotes
2024-12-02 17:20:57 +01:00
William Martin
bd44d33eaa
Add checkout test that uses ssh git remote url
2024-11-27 13:06:35 +01:00
William Martin
72a6fd00a4
Rename backwards compatible credentials pattern
2024-11-27 12:21:55 +01:00
William Martin
efd8ff6d46
General cleanup and docs
2024-11-26 22:30:11 +01:00
William Martin
6b7f1ff060
Allow client fetch to use insecure credentials pattern
2024-11-26 22:30:03 +01:00
William Martin
7affcadb5e
Allow client push to use insecure credential pattern
2024-11-26 22:29:58 +01:00
William Martin
75712de712
Allow client pull to use insecure credential pattern
2024-11-26 22:29:51 +01:00
William Martin
46922694dc
Support secure credential pattern
2024-11-26 22:29:38 +01:00
Dalius Dobravolskas
9414930b5d
Adding option to return baseRefOid in pr view
...
You need to know exact `baseRefOid` so you could show correct diff.
`baseRefName` is not enough sometimes because branch from which PR was
forked might have changes already.
Example usage:
```
gh pr view --json headRefName,headRefOid,number,baseRefName,baseRefOid,reviewDecision
```
2024-11-19 23:50:45 +02:00
nilvng
2eaab56912
chore: tidy up
2024-11-07 10:20:23 +11:00
nilvng
874fa7ad4d
feat: add test
2024-11-07 10:20:23 +11:00
nilvng
a780b488a3
fix: ignore template flag
2024-11-07 10:20:23 +11:00
Tyler McGoffin
14acbe00a9
Remove . from test case for TestTitleSurvey
2024-10-17 14:45:35 -07:00
Tyler McGoffin
13ab02729b
Clean up Title Survey empty title message code
2024-10-17 14:40:17 -07:00
Tyler McGoffin
c1897f3122
Merge branch 'trunk' into jtmcg/9698
2024-10-15 15:15:31 -07:00
Tyler McGoffin
e1a39d8e2b
Add ghe.com to tests describing ghec data residency
2024-10-15 12:24:41 -07:00
Tyler McGoffin
4df2e7be63
Remove comment
2024-10-15 12:16:20 -07:00
Tyler McGoffin
81591a09b8
Use go-gh/auth package for IsEnterprise, IsTenancy, and NormalizeHostname
2024-10-15 11:56:43 -07:00