@@ -165,7 +165,7 @@ func (t *httpSmartSubtransport) Action(transportOptionsURL string, action git2go
165
165
// Therefore, on the initial GET operation we update the target URL to include the
166
166
// new target, so the subsequent actions include the correct target URL.
167
167
// Example of this is trying to access a Git repository without the .git suffix.
168
- if req .Response != nil && req . Response . StatusCode == http . StatusMovedPermanently {
168
+ if req .Response != nil {
169
169
if newURL , err := req .Response .Location (); err == nil && newURL != nil {
170
170
if strings .EqualFold (newURL .Host , req .URL .Host ) && strings .EqualFold (newURL .Port (), req .URL .Port ()) {
171
171
opts , _ := getTransportOptions (transportOptionsURL )
@@ -175,6 +175,9 @@ func (t *httpSmartSubtransport) Action(transportOptionsURL string, action git2go
175
175
176
176
opts .TargetURL = trimActionSuffix (newURL .String ())
177
177
AddTransportOptions (transportOptionsURL , * opts )
178
+
179
+ debugLog .Info ("[http]: server responded with redirect" ,
180
+ "newURL" , opts .TargetURL , "StatusCode" , req .Response .StatusCode )
178
181
}
179
182
}
180
183
}
@@ -419,7 +422,6 @@ func (self *httpSmartSubtransportStream) sendRequest() error {
419
422
return err
420
423
}
421
424
422
- traceLog .Info ("[http]: POST redirect" , "URL" , self .req .URL )
423
425
continue
424
426
}
425
427
@@ -435,7 +437,7 @@ func (self *httpSmartSubtransportStream) sendRequest() error {
435
437
return err
436
438
}
437
439
438
- return fmt .Errorf ("Unhandled HTTP error %s" , resp .Status )
440
+ return fmt .Errorf ("unhandled HTTP error %s" , resp .Status )
439
441
}
440
442
441
443
self .resp = resp
0 commit comments