Skip to content

Commit 23382f4

Browse files
committed
Merge branch 'trunk' into gh-attestation-tuf-client-retry
2 parents f2f769c + 2cdee00 commit 23382f4

13 files changed

Lines changed: 499 additions & 16 deletions

File tree

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ require (
4444
github.com/opentracing/opentracing-go v1.2.0
4545
github.com/rivo/tview v0.0.0-20221029100920-c4a7e501810d
4646
github.com/shurcooL/githubv4 v0.0.0-20240120211514-18a1ae0e79dc
47-
github.com/sigstore/protobuf-specs v0.4.1
47+
github.com/sigstore/protobuf-specs v0.4.2
4848
github.com/sigstore/sigstore-go v1.0.0
4949
github.com/spf13/cobra v1.9.1
5050
github.com/spf13/pflag v1.0.6
5151
github.com/stretchr/testify v1.10.0
5252
github.com/theupdateframework/go-tuf/v2 v2.1.1
53-
github.com/yuin/goldmark v1.7.8
53+
github.com/yuin/goldmark v1.7.12
5454
github.com/zalando/go-keyring v0.2.5
5555
golang.org/x/crypto v0.38.0
5656
golang.org/x/sync v0.14.0

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@ github.com/shurcooL/githubv4 v0.0.0-20240120211514-18a1ae0e79dc h1:vH0NQbIDk+mJL
455455
github.com/shurcooL/githubv4 v0.0.0-20240120211514-18a1ae0e79dc/go.mod h1:zqMwyHmnN/eDOZOdiTohqIUKUrTFX62PNlu7IJdu0q8=
456456
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466 h1:17JxqqJY66GmZVHkmAsGEkcIu0oCe3AM420QDgGwZx0=
457457
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466/go.mod h1:9dIRpgIY7hVhoqfe0/FcYp0bpInZaT7dc3BYOprrIUE=
458-
github.com/sigstore/protobuf-specs v0.4.1 h1:5SsMqZbdkcO/DNHudaxuCUEjj6x29tS2Xby1BxGU7Zc=
459-
github.com/sigstore/protobuf-specs v0.4.1/go.mod h1:+gXR+38nIa2oEupqDdzg4qSBT0Os+sP7oYv6alWewWc=
458+
github.com/sigstore/protobuf-specs v0.4.2 h1:bD5bnhctpGNiR+FAEZl7N95XkN8TJFrNMIcWLunDtxA=
459+
github.com/sigstore/protobuf-specs v0.4.2/go.mod h1:+gXR+38nIa2oEupqDdzg4qSBT0Os+sP7oYv6alWewWc=
460460
github.com/sigstore/rekor v1.3.10 h1:/mSvRo4MZ/59ECIlARhyykAlQlkmeAQpvBPlmJtZOCU=
461461
github.com/sigstore/rekor v1.3.10/go.mod h1:JvryKJ40O0XA48MdzYUPu0y4fyvqt0C4iSY7ri9iu3A=
462462
github.com/sigstore/sigstore v1.9.4 h1:64+OGed80+A4mRlNzRd055vFcgBeDghjZw24rPLZgDU=
@@ -521,8 +521,8 @@ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavM
521521
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
522522
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
523523
github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
524-
github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
525-
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
524+
github.com/yuin/goldmark v1.7.12 h1:YwGP/rrea2/CnCtUHgjuolG/PnMxdQtPMO5PvaE2/nY=
525+
github.com/yuin/goldmark v1.7.12/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
526526
github.com/yuin/goldmark-emoji v1.0.5 h1:EMVWyCGPlXJfUXBXpuMu+ii3TIaxbVBnEX9uaDC4cIk=
527527
github.com/yuin/goldmark-emoji v1.0.5/go.mod h1:tTkZEbwu5wkPmgTcitqddVxY9osFZiavD+r4AzQrh1U=
528528
github.com/zalando/go-keyring v0.2.5 h1:Bc2HHpjALryKD62ppdEzaFG6VxL6Bc+5v0LYpN8Lba8=

internal/ghcmd/cmd.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ import (
2929
"github.com/spf13/cobra"
3030
)
3131

32-
// updaterEnabled is a statically linked build property set in gh formula within homebrew/homebrew-core
33-
// used to control whether users are notified of newer GitHub CLI releases.
34-
// This needs to be set to 'cli/cli' as it affects where update.CheckForUpdate() checks for releases.
35-
// It is unclear whether this means that only homebrew builds will check for updates or not.
36-
// Development builds leave this empty as impossible to determine if newer or not.
37-
// For more information, <https://github.com/Homebrew/homebrew-core/blob/master/Formula/g/gh.rb>.
38-
var updaterEnabled = ""
39-
4032
type exitCode int
4133

4234
const (

internal/ghcmd/update_disabled.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//go:build !updateable
2+
3+
package ghcmd
4+
5+
// See update_enabled.go comment for more information.
6+
var updaterEnabled = ""

internal/ghcmd/update_enabled.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//go:build updateable
2+
3+
package ghcmd
4+
5+
// `updateable` is a build tag set in the gh formula within homebrew/homebrew-core
6+
// and is used to control whether users are notified of newer GitHub CLI releases.
7+
//
8+
// Currently, updaterEnabled needs to be set to 'cli/cli' as it affects where
9+
// update.CheckForUpdate() checks for releases. It is unclear to what extent
10+
// this updaterEnabled is being used by unofficial forks or builds, so we decided
11+
// to leave it available for injection as a string variable for now.
12+
//
13+
// Development builds do not generate update messages by default.
14+
//
15+
// For more information, see:
16+
// - the Homebrew formula for gh: <https://github.com/Homebrew/homebrew-core/blob/master/Formula/g/gh.rb>.
17+
// - a discussion about adding this build tag: <https://github.com/cli/cli/pull/11024#discussion_r2107597618>.
18+
var updaterEnabled = "cli/cli"

pkg/cmd/gist/edit/edit.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ func editRun(opts *EditOptions) error {
236236
if filename == "" {
237237
if len(candidates) == 1 {
238238
filename = candidates[0]
239+
} else if len(candidates) == 0 {
240+
return errors.New("no file in the gist")
239241
} else {
240242
if !opts.IO.CanPrompt() {
241243
return errors.New("unsure what file to edit; either specify --filename or run interactively")

pkg/cmd/gist/edit/edit_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,30 @@ func Test_editRun(t *testing.T) {
557557
},
558558
wantErr: "gist ID or URL required when not running interactively",
559559
},
560+
{
561+
name: "edit no-file gist (#10626)",
562+
opts: &EditOptions{
563+
Selector: "1234",
564+
},
565+
mockGist: &shared.Gist{
566+
ID: "1234",
567+
Files: map[string]*shared.GistFile{},
568+
Owner: &shared.GistOwner{Login: "octocat"},
569+
},
570+
wantErr: "no file in the gist",
571+
},
572+
{
573+
name: "edit no-file gist, nil map (#10626)",
574+
opts: &EditOptions{
575+
Selector: "1234",
576+
},
577+
mockGist: &shared.Gist{
578+
ID: "1234",
579+
Files: nil,
580+
Owner: &shared.GistOwner{Login: "octocat"},
581+
},
582+
wantErr: "no file in the gist",
583+
},
560584
}
561585

562586
for _, tt := range tests {

pkg/cmd/gist/shared/shared.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ func (g Gist) Filename() string {
4444
for fn := range g.Files {
4545
filenames = append(filenames, fn)
4646
}
47+
if len(filenames) == 0 {
48+
return ""
49+
}
4750
sort.Strings(filenames)
4851
return filenames[0]
4952
}

pkg/cmd/gist/shared/shared_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,33 @@ func TestPromptGists(t *testing.T) {
163163
response: `{ "data": { "viewer": { "gists": { "nodes": [] } } } }`,
164164
wantOut: Gist{},
165165
},
166+
{
167+
name: "prompt list contains no-file gist (#10626)",
168+
prompterStubs: func(pm *prompter.MockPrompter) {
169+
pm.RegisterSelect("Select a gist",
170+
[]string{" about 6 hours ago", "gistfile0.txt about 6 hours ago"},
171+
func(_, _ string, opts []string) (int, error) {
172+
return prompter.IndexFor(opts, " about 6 hours ago")
173+
})
174+
},
175+
response: `{ "data": { "viewer": { "gists": { "nodes": [
176+
{
177+
"name": "1234",
178+
"files": [],
179+
"description": "",
180+
"updatedAt": "%[1]v",
181+
"isPublic": true
182+
},
183+
{
184+
"name": "5678",
185+
"files": [{ "name": "gistfile0.txt" }],
186+
"description": "",
187+
"updatedAt": "%[1]v",
188+
"isPublic": true
189+
}
190+
] } } } }`,
191+
wantOut: Gist{ID: "1234", Files: map[string]*GistFile{}, UpdatedAt: sixHoursAgo, Public: true},
192+
},
166193
}
167194

168195
ios, _, _, _ := iostreams.Test()

pkg/cmd/pr/create/create.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
201201
Long: heredoc.Docf(`
202202
Create a pull request on GitHub.
203203
204+
Upon success, the URL of the created pull request will be printed.
205+
204206
When the current branch isn't fully pushed to a git remote, a prompt will ask where
205207
to push the branch and offer an option to fork the base repository. Use %[1]s--head%[1]s to
206208
explicitly skip any forking or pushing behavior.

0 commit comments

Comments
 (0)