aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2017-06-12 13:51:01 +0200
committerSantiago M. Mola <santi@mola.io>2017-06-13 15:39:49 +0200
commit9ebf0e651465fc304405d0253f837c1b5e929c24 (patch)
treed04998bc8081f869a3c91a72ea49e954d8938572
parent1deb0fa5a1e8ed605d78717db288d5a8685e2a5d (diff)
downloadgo-git-9ebf0e651465fc304405d0253f837c1b5e929c24.tar.gz
plumbing/transport: detect "access denied error"
"ERR access denied or repository not exported:" is now detected as transport.ErrRepositoryNotFound, since that's what git-daemon returns when --informative-errors is not used.
-rw-r--r--plumbing/transport/internal/common/common.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/plumbing/transport/internal/common/common.go b/plumbing/transport/internal/common/common.go
index 41be776..d947d28 100644
--- a/plumbing/transport/internal/common/common.go
+++ b/plumbing/transport/internal/common/common.go
@@ -333,11 +333,12 @@ func (s *session) checkNotFoundError() error {
}
var (
- githubRepoNotFoundErr = "ERROR: Repository not found."
- bitbucketRepoNotFoundErr = "conq: repository does not exist."
- localRepoNotFoundErr = "does not appear to be a git repository"
- gitProtocolNotFoundErr = "ERR \n Repository not found."
- gitProtocolNoSuchErr = "ERR no such repository"
+ githubRepoNotFoundErr = "ERROR: Repository not found."
+ bitbucketRepoNotFoundErr = "conq: repository does not exist."
+ localRepoNotFoundErr = "does not appear to be a git repository"
+ gitProtocolNotFoundErr = "ERR \n Repository not found."
+ gitProtocolNoSuchErr = "ERR no such repository"
+ gitProtocolAccessDeniedErr = "ERR access denied"
)
func isRepoNotFoundError(s string) bool {
@@ -361,6 +362,10 @@ func isRepoNotFoundError(s string) bool {
return true
}
+ if strings.HasPrefix(s, gitProtocolAccessDeniedErr) {
+ return true
+ }
+
return false
}