This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ func Objects(
24
24
seen := hashListToSet (ignore )
25
25
result := make (map [plumbing.Hash ]bool )
26
26
27
+ cleanerFunc := func (h plumbing.Hash ) {
28
+ seen [h ] = true
29
+ }
30
+
31
+ for _ , h := range ignore {
32
+ processObject (s , h , hashListToSet ([]plumbing.Hash {}), cleanerFunc )
33
+ }
34
+
27
35
walkerFunc := func (h plumbing.Hash ) {
28
36
if ! seen [h ] {
29
37
result [h ] = true
Original file line number Diff line number Diff line change @@ -145,6 +145,34 @@ type AuthMethod interface {
145
145
setAuth (r * http.Request )
146
146
}
147
147
148
+ // TokenAuthMethod is concrete implementation of common.AuthMethod for HTTP services
149
+ // Allow Bearer Token used in git authentication.
150
+ type TokenAuth struct {
151
+ token string
152
+ }
153
+
154
+ // NewTokenAuth returns a tokenAuth on the given authrorization token.
155
+ func NewTokenAuth (token string ) * TokenAuth {
156
+ return & TokenAuth {token }
157
+ }
158
+
159
+ func (a * TokenAuth ) setAuth (r * http.Request ) {
160
+ if a == nil {
161
+ return
162
+ }
163
+
164
+ r .Header .Set ("Authorization" , a .token )
165
+ }
166
+
167
+ // Name is name of the auth
168
+ func (a * TokenAuth ) Name () string {
169
+ return "http-token-auth"
170
+ }
171
+
172
+ func (a * TokenAuth ) String () string {
173
+ return fmt .Sprintf ("%s..." , a .token [:10 ])
174
+ }
175
+
148
176
func basicAuthFromEndpoint (ep transport.Endpoint ) * BasicAuth {
149
177
u := ep .User ()
150
178
if u == "" {
You can’t perform that action at this time.
0 commit comments