35 Commits
Author SHA1 Message Date
Ajay Kemparaj f9fec07de4 feat: Require Go 1.26 and use new(expr) for pointer literals (#4481) 2026-08-28 12:18:49 -04:00
Oleksandr Redko 3215e0320e test: Remove redundant Marshal tests (#4266) 2026-06-04 09:22:07 -04:00
Dhananjay Mishra 0a16e22eba refactor: Use testJSONBody helper for request body assertions in tests (#4183) 2026-05-01 08:13:24 -04:00
Glenn Lewis a2063a76fb chore: Remove unnecessary use of new and &SomeStruct{} and add new extraneousnew custom linter (#4106) 2026-03-18 17:12:53 -04:00
Oleksandr Redko 5158bb8e5f chore: Improve testJSONMarshal (#4042) 2026-02-27 07:27:18 -05:00
Oleksandr Redko 49af123778 fix!: Simplify Git.ListMatchingRefs by removing ReferenceListOptions (#3924)
BREAKING CHANGE: `Git.ListMatchingRefs` accepts `ref` instead of `ReferenceListOptions`.
2026-01-18 12:18:09 -05:00
Glenn Lewis 4505771989 Prefer %v over %d,%s and add fmtpercentv custom linter (#3756) 2025-10-05 21:39:53 -04:00
Oleksandr Redko 233fe03e17 test: Use t.Context() instead of context.Background() (#3750) 2025-10-03 08:09:47 -04:00
Rupok Ghosh db8be8bc7f refactor!: Change GitService methods to pass required params by-value instead of by-ref (#3654)
BREAKING CHANGE: `GitService` methods now pass required params by-value instead of by-ref.
2025-08-04 15:02:50 -04:00
Oleksandr Redko d88d529592 fix: Add validation for nil inputs in various services (#3636) 2025-07-24 12:41:25 -04:00
Oleksandr Redko ff1666c906 refactor: Fix revive.unnecessary-format lint issues (#3629) 2025-07-19 14:01:40 -04:00
Oleksandr Redko 9493278195 refactor: fix revive.unused-parameter lint issues (#3603) 2025-06-25 11:44:09 -04:00
Oleksandr Redko f66ed85955 feat: Deprecate and replace Bool,Int,Int64,String with Ptr using generics (#3355) 2024-12-10 21:36:09 -05:00
Glenn Lewis dc884c26ca Add t.Parallel to unit tests (#3297) 2024-10-05 07:29:05 -04:00
Glenn Lewis e56d378b96 refactor: Do not call teardown manually in tests (#3296) 2024-10-01 11:52:30 -04:00
WillAbides fd33b81221 Fix linting (#2903) 2023-09-08 08:55:37 -04:00
Shravan Konduru ae774d0751 Escape special characters in ref name for update ref (#2454)
Fixes: #2453.
2022-09-12 08:49:09 -04:00
Sagar Sonwane abde3c93d1 Add test cases for JSON resource marshaling (#1970) 2021-07-13 13:13:06 -04:00
Sagar Sonwane 51e7595f87 fix: Updated comparisons in test files (#1875)
Replaced all reflect.DeepEqual comparisons in test files with cmp.Equal.

Fixes: #1851
2021-05-26 11:49:24 -07:00
Glenn Lewis 2744b70055 Improve git_refs.go coverage (#1734) 2020-12-25 19:00:03 -05:00
Glenn Lewis 460db534b8 Refactor context.Background in tests (#1672) 2020-12-16 05:58:28 -05:00
Billy Keyes da2666cfac Use new endpoints to get and list references (#1513)
Fixes #1512.
2020-05-06 22:14:22 -04:00
Hanno Hecker cb1e3f4500 Do not encode / in ref names (#1433)
Fixes: #1432.
2020-02-22 09:44:04 -05:00
kadern0 69231319df Change opt param to opts (#1417)
Fixes #1415.
2020-02-09 20:01:54 -05:00
William Cooke 035bec247b Consistent errors for GetRef when a Ref doesn't exist (#1207)
Fixes #1208.
2019-07-08 18:02:04 -04:00
Shagun Khemka 29a3681d05 Remove custom media type for global node IDs (#925)
Fixes #919.
2018-08-10 11:23:19 -04:00
Anubha Kushwaha cbeb72eaf5 Support preview GraphQL API v4 Node IDs. (#817)
Add NodeID field to objects that now expose it.

Reference: https://developer.github.com/changes/2017-12-19-graphql-node-id/.
2018-01-09 16:35:34 -05:00
Chris King df88dd9538 Remove global test variables in favor of local. (#766)
This refactor removes the global test variables used by all tests,
replacing them with local variables that are independent in each test.

This is better style, easier to read and be confident about correctness,
and allows tests to be parallelized in the future.

Resolves #762.
2017-12-02 14:34:41 -05:00
Aleks Clark 06a55d192d Add GitService.GetRefs method for multiple refs; update GetRef. (#603)
The Get a Reference "GET /repos/:owner/:repo/git/refs/:ref" endpoint,
documented at https://developer.github.com/v3/git/refs/#get-a-reference,
can return multiple references if there is no exact match for ref.

This change adds GitService.GetRefs method that is a more 1:1 mapping
to that GitHub API endpoint. It returns a slice of references.
The slice contains 1 reference if there was an exact match, otherwise
multiple references that begin with ref. If there are no such
references, a not found error is returned.

The current behavior and signature of GitService.GetRef method is
unmodified. Its purpose is to fetch a single exact match for a
reference, or return a not found error if there's no exact match.
The returned error text is improved for situations when there's no
exact match but GitHub API returns an array containing multiple refs
that have ref as prefix. Previously, it was a JSON decoding error,
now it says "no exact match found for this ref".

Fixes #588.
2017-04-20 21:17:29 -04:00
Dmitri Shuralyov 23d6cb9cac Add support for context package to all endpoints. (#529)
This is a large breaking API change. It is unavoidable and necessary
to resolve #526. This breaking change is part of bump to libraryVersion 3.

It adds ctx context.Context as first parameter to all endpoint methods,
including Do.

Updating for this API change should be easy and the compiler will help
catch instances that need to be updated. For example:

	main.go:193: not enough arguments in call to gh.Activity.MarkRepositoryNotificationsRead
		have (string, string, time.Time)
		want (context.Context, string, string, time.Time)
	...

You should pass the available context as first parameter. If your code
does not have context.Context available and you want to maintain previous
normal behavior, use context.Background(). Don't pass nil context; use
context.TODO() instead if you wish to delay figuring out the best context
to use. Then you can address the TODO at a later time.

Refer to documentation of package context at https://godoc.org/context
for more information.

This commit also changes ./tests/fields to use context.Background()
instead of deprecated oauth2.NoContext.

Resolves #526.
2017-02-20 16:05:42 -05:00
Glenn Lewis 4ea1b10b74 replace []Issue with []*Issue and for other large structs as well
Note that this is an API-breaking change but should have minimal
impact on users of this package due to the nice inference
properties of the Go programming language.

Bumped `libraryVersion` to `2` due to API-breaking change as
discussed in #376.

Fixes #180.

Change-Id: Ib386135e6b8f306d1f54278968c576f3ceccc4e7
2016-06-19 19:42:35 -07:00
Will Norris 212ef69ded support refs with or without 'refs/' prefix
The git ref methods were mostly written to not expect the 'refs/' prefix
on ref names, even though it is included the ref.Ref value returned by
GitHub.  This resulted in ref values returned from some methods that
couldn't be passed to other methods.  In reality, ref names passed to
these methods should normally include the prefix, but this change
supports either form for backwards compatibility.

Fixes #133
2014-09-04 08:04:46 -07:00
Will Norris 7aa0972552 add pagination support for more methods
This includes all of the methods mentioned in this blog post:
https://developer.github.com/changes/2014-03-18-paginating-method-changes/
as well as a handful of others I found.  Sadly, this is a breaking
change for many of these methods because it changes the method
signature, but with yesterday's API change these methods are now broken
anyway. :(
2014-04-17 16:49:17 -07:00
Will Norris cc2d2c1c98 add options to Git.ListRefs
this is a breaking change, but this was only recently added so I'm not
too worried.  This also seems the best way to handle sub-namespaces on
this method.
2014-04-11 08:50:42 -07:00
Ondrej Kupka cab36cd2eb GitService: Add support for refs
This commit adds support for Git refs.

Listing of refs does not support sub-namespaces.
2013-12-02 11:23:09 -08:00