X Tutup
Skip to content

Commit bc81282

Browse files
committed
Merge remote-tracking branch 'origin' into git-credentials
2 parents 3c76eb1 + f415245 commit bc81282

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1131
-235
lines changed

.github/CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ Please note that this project adheres to a [Contributor Code of Conduct][code-of
4444

4545
We generate manual pages from source on every release. You do not need to submit pull requests for documentation specifically; manual pages for commands will automatically get updated after your pull requests gets accepted.
4646

47+
## Design guidelines
48+
49+
You may reference the [CLI Design System][] when suggesting features, and are welcome to use our [Google Docs Template][] to suggest designs.
50+
4751
## Resources
4852

4953
- [How to Contribute to Open Source][]
@@ -61,3 +65,5 @@ We generate manual pages from source on every release. You do not need to submit
6165
[How to Contribute to Open Source]: https://opensource.guide/how-to-contribute/
6266
[Using Pull Requests]: https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/about-pull-requests
6367
[GitHub Help]: https://docs.github.com/
68+
[CLI Design System]: https://primer.style/cli/
69+
[Google Docs Template]: https://docs.google.com/document/d/1JIRErIUuJ6fTgabiFYfCH3x91pyHuytbfa0QLnTfXKM/edit#heading=h.or54sa47ylpg

Makefile

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@ else
99
BUILD_DATE ?= $(shell date "$(DATE_FMT)")
1010
endif
1111

12-
ifndef CGO_CPPFLAGS
13-
export CGO_CPPFLAGS := $(CPPFLAGS)
14-
endif
15-
ifndef CGO_CFLAGS
16-
export CGO_CFLAGS := $(CFLAGS)
17-
endif
18-
ifndef CGO_LDFLAGS
19-
export CGO_LDFLAGS := $(LDFLAGS)
20-
endif
12+
CGO_CPPFLAGS ?= ${CPPFLAGS}
13+
export CGO_CPPFLAGS
14+
CGO_CFLAGS ?= ${CFLAGS}
15+
export CGO_CFLAGS
16+
CGO_LDFLAGS ?= ${LDFLAGS}
17+
export CGO_LDFLAGS
2118

2219
GO_LDFLAGS := -X github.com/cli/cli/internal/build.Version=$(GH_VERSION) $(GO_LDFLAGS)
2320
GO_LDFLAGS := -X github.com/cli/cli/internal/build.Date=$(BUILD_DATE) $(GO_LDFLAGS)
@@ -27,7 +24,7 @@ ifdef GH_OAUTH_CLIENT_SECRET
2724
endif
2825

2926
bin/gh: $(BUILD_FILES)
30-
@go build -trimpath -ldflags "$(GO_LDFLAGS)" -o "$@" ./cmd/gh
27+
go build -trimpath -ldflags "${GO_LDFLAGS}" -o "$@" ./cmd/gh
3128

3229
clean:
3330
rm -rf ./bin ./share
@@ -58,7 +55,22 @@ endif
5855
git -C site commit -m '$(GITHUB_REF:refs/tags/v%=%)' index.html
5956
.PHONY: site-bump
6057

61-
6258
.PHONY: manpages
6359
manpages:
6460
go run ./cmd/gen-docs --man-page --doc-path ./share/man/man1/
61+
62+
DESTDIR :=
63+
prefix := /usr/local
64+
bindir := ${prefix}/bin
65+
mandir := ${prefix}/share/man
66+
67+
.PHONY: install
68+
install: bin/gh manpages
69+
install -d ${DESTDIR}${bindir}
70+
install -m755 bin/gh ${DESTDIR}${bindir}/
71+
install -d ${DESTDIR}${mandir}/man1
72+
install -m644 ./share/man/man1/* ${DESTDIR}${mandir}/man1/
73+
74+
.PHONY: uninstall
75+
uninstall:
76+
rm -f ${DESTDIR}${bindir}/gh ${DESTDIR}${mandir}/man1/gh.1 ${DESTDIR}${mandir}/man1/gh-*.1

README.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,9 @@ For more information and distro-specific instructions, see the [Linux installati
5555

5656
#### scoop
5757

58-
Install:
59-
60-
```powershell
61-
scoop bucket add github-gh https://github.com/cli/scoop-gh.git
62-
scoop install gh
63-
```
64-
65-
Upgrade:
66-
67-
```powershell
68-
scoop update gh
69-
```
58+
| Install: | Upgrade: |
59+
| ------------------ | ------------------ |
60+
| `scoop install gh` | `scoop update gh` |
7061

7162
#### Chocolatey
7263

api/cache.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
func makeCachedClient(httpClient *http.Client, cacheTTL time.Duration) *http.Client {
2020
cacheDir := filepath.Join(os.TempDir(), "gh-cli-cache")
2121
return &http.Client{
22-
Transport: CacheReponse(cacheTTL, cacheDir)(httpClient.Transport),
22+
Transport: CacheResponse(cacheTTL, cacheDir)(httpClient.Transport),
2323
}
2424
}
2525

@@ -39,8 +39,8 @@ func isCacheableResponse(res *http.Response) bool {
3939
return res.StatusCode < 500 && res.StatusCode != 403
4040
}
4141

42-
// CacheReponse produces a RoundTripper that caches HTTP responses to disk for a specified amount of time
43-
func CacheReponse(ttl time.Duration, dir string) ClientOption {
42+
// CacheResponse produces a RoundTripper that caches HTTP responses to disk for a specified amount of time
43+
func CacheResponse(ttl time.Duration, dir string) ClientOption {
4444
fs := fileStorage{
4545
dir: dir,
4646
ttl: ttl,

api/cache_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/stretchr/testify/require"
1515
)
1616

17-
func Test_CacheReponse(t *testing.T) {
17+
func Test_CacheResponse(t *testing.T) {
1818
counter := 0
1919
fakeHTTP := funcTripper{
2020
roundTrip: func(req *http.Request) (*http.Response, error) {
@@ -32,7 +32,7 @@ func Test_CacheReponse(t *testing.T) {
3232
}
3333

3434
cacheDir := filepath.Join(t.TempDir(), "gh-cli-cache")
35-
httpClient := NewHTTPClient(ReplaceTripper(fakeHTTP), CacheReponse(time.Minute, cacheDir))
35+
httpClient := NewHTTPClient(ReplaceTripper(fakeHTTP), CacheResponse(time.Minute, cacheDir))
3636

3737
do := func(method, url string, body io.Reader) (string, error) {
3838
req, err := http.NewRequest(method, url, body)

api/queries_pr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ func PullRequestForBranch(client *Client, repo ghrepo.Interface, baseBranch, hea
639639
query := `
640640
query PullRequestForBranch($owner: String!, $repo: String!, $headRefName: String!, $states: [PullRequestState!]) {
641641
repository(owner: $owner, name: $repo) {
642-
pullRequests(headRefName: $headRefName, states: $states, first: 30) {
642+
pullRequests(headRefName: $headRefName, states: $states, first: 30, orderBy: { field: CREATED_AT, direction: DESC }) {
643643
nodes {
644644
id
645645
number

api/queries_repo.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,28 @@ func (m *RepoMetadataResult) MilestoneToID(title string) (string, error) {
464464
return "", errors.New("not found")
465465
}
466466

467+
func (m *RepoMetadataResult) Merge(m2 *RepoMetadataResult) {
468+
if len(m2.AssignableUsers) > 0 || len(m.AssignableUsers) == 0 {
469+
m.AssignableUsers = m2.AssignableUsers
470+
}
471+
472+
if len(m2.Teams) > 0 || len(m.Teams) == 0 {
473+
m.Teams = m2.Teams
474+
}
475+
476+
if len(m2.Labels) > 0 || len(m.Labels) == 0 {
477+
m.Labels = m2.Labels
478+
}
479+
480+
if len(m2.Projects) > 0 || len(m.Projects) == 0 {
481+
m.Projects = m2.Projects
482+
}
483+
484+
if len(m2.Milestones) > 0 || len(m.Milestones) == 0 {
485+
m.Milestones = m2.Milestones
486+
}
487+
}
488+
467489
type RepoMetadataInput struct {
468490
Assignees bool
469491
Reviewers bool

cmd/gh/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ func main() {
140140
fmt.Fprintln(stderr, cs.Bold("Welcome to GitHub CLI!"))
141141
fmt.Fprintln(stderr)
142142
fmt.Fprintln(stderr, "To authenticate, please run `gh auth login`.")
143-
fmt.Fprintln(stderr, "You can also set the one of the auth token environment variables, if preferred.")
144143
os.Exit(4)
145144
}
146145

context/remote_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ func Test_Remotes_FindByName(t *testing.T) {
2828
eq(t, err, nil)
2929
eq(t, r.Name, "upstream")
3030

31-
r, err = list.FindByName("nonexist", "*")
31+
r, err = list.FindByName("nonexistent", "*")
3232
eq(t, err, nil)
3333
eq(t, r.Name, "mona")
3434

35-
_, err = list.FindByName("nonexist")
35+
_, err = list.FindByName("nonexistent")
3636
eq(t, err, errors.New(`no GitHub remotes found`))
3737
}
3838

docs/install_linux.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ sudo pacman -S github-cli
9595

9696
### Android
9797

98-
Android users can install via Termux:
98+
Android 7+ users can install via [Termux](https://wiki.termux.com/wiki/Main_Page):
9999

100100
```bash
101101
pkg install gh

0 commit comments

Comments
 (0)
X Tutup