зеркало из https://github.com/mislav/hub.git
Ensure consistent sort direction when listing issues, PRs
The default direction when sorting by `created` date (the default) is descending. However, the default on the API backend changes to ascending when the sort key is something different than `created`: https://developer.github.com/v3/pulls/#list-pull-requests This ensures that the default `direction: "desc"` is always passed to API queries, regardless of the sort key, unless `--sort-ascending` was used. Ref. https://github.com/github/hub/issues/1815#issuecomment-433222344
This commit is contained in:
Родитель
bd8042ec75
Коммит
b15d8de5e4
|
@ -248,6 +248,8 @@ func listIssues(cmd *Command, args *Args) {
|
|||
|
||||
if flagIssueSortAscending {
|
||||
filters["direction"] = "asc"
|
||||
} else {
|
||||
filters["direction"] = "desc"
|
||||
}
|
||||
|
||||
if cmd.FlagPassed("since") {
|
||||
|
|
|
@ -182,6 +182,8 @@ func listPulls(cmd *Command, args *Args) {
|
|||
}
|
||||
if flagPullRequestSortAscending {
|
||||
filters["direction"] = "asc"
|
||||
} else {
|
||||
filters["direction"] = "desc"
|
||||
}
|
||||
|
||||
pulls, err := gh.FetchPullRequests(project, filters, flagPullRequestLimit, nil)
|
||||
|
|
|
@ -9,7 +9,7 @@ Feature: hub issue
|
|||
get('/repos/github/hub/issues') {
|
||||
assert :assignee => "Cornwe19",
|
||||
:sort => nil,
|
||||
:direction => nil
|
||||
:direction => "desc"
|
||||
|
||||
json [
|
||||
{ :number => 999,
|
||||
|
@ -76,7 +76,7 @@ Feature: hub issue
|
|||
get('/repos/github/hub/issues') {
|
||||
assert :assignee => "Cornwe19",
|
||||
:sort => nil,
|
||||
:direction => nil
|
||||
:direction => "desc"
|
||||
|
||||
json [
|
||||
{ :number => 999,
|
||||
|
|
|
@ -10,7 +10,7 @@ Feature: hub pr list
|
|||
assert :per_page => "100",
|
||||
:page => :no,
|
||||
:sort => nil,
|
||||
:direction => nil
|
||||
:direction => "desc"
|
||||
|
||||
response.headers["Link"] = %(<https://api.github.com/repositories/12345?per_page=100&page=2>; rel="next")
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче