diff options
| author | Vicent Martà <tanoku@gmail.com> | 2011-12-22 13:29:03 -0800 |
|---|---|---|
| committer | Vicent Martà <tanoku@gmail.com> | 2011-12-22 13:29:03 -0800 |
| commit | 1b8cbe8be82cd55b900453a6bea7d9068c39c825 (patch) | |
| tree | 5eb617e28bfc7f6aab0b26dd6e1dd0de79f7c891 /src | |
| parent | 1bdba3386d9953c722d9302f414156104cc06945 (diff) | |
| parent | db1f7e596c072380ec994ae2e71556fc0a6568f7 (diff) | |
| download | libgit2-1b8cbe8be82cd55b900453a6bea7d9068c39c825.tar.gz | |
Merge pull request #517 from nulltoken/fix/local-remote-ls
Small enhancements to remote-ls when working against local repositories
Diffstat (limited to 'src')
| -rw-r--r-- | src/transports/local.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/transports/local.c b/src/transports/local.c index 6cf0573e8..c433339a7 100644 --- a/src/transports/local.c +++ b/src/transports/local.c @@ -46,14 +46,12 @@ static int add_ref(transport_local *t, const char *name) if (error < GIT_SUCCESS) goto out; - git_oid_cpy(&head->oid, git_reference_oid(ref)); + git_oid_cpy(&head->oid, git_reference_oid(resolved_ref)); error = git_vector_insert(&t->refs, head); if (error < GIT_SUCCESS) goto out; - head = NULL; - /* If it's not a tag, we don't need to try to peel it */ if (git__prefixcmp(name, GIT_REFS_TAGS_DIR)) goto out; @@ -63,6 +61,8 @@ static int add_ref(transport_local *t, const char *name) git__rethrow(error, "Failed to lookup object"); } + head = NULL; + /* If it's not an annotated tag, just get out */ if (git_object_type(obj) != GIT_OBJ_TAG) goto out; @@ -163,20 +163,30 @@ static int local_connect(git_transport *transport, int GIT_UNUSED(direction)) GIT_UNUSED_ARG(direction); /* The repo layer doesn't want the prefix */ - if (!git__prefixcmp(transport->url, file_prefix)) - path = transport->url + strlen(file_prefix); - else + if (!git__prefixcmp(transport->url, "file://")) { + path = transport->url + strlen("file://"); + +#ifdef _MSC_VER + /* skip the leading slash on windows before the drive letter */ + if (*path != '/') + return git__throw(GIT_EINVALIDPATH, "Invalid local uri '%s'.", transport->url); + + path++; +#endif + + } else path = transport->url; error = git_repository_open(&repo, path); if (error < GIT_SUCCESS) return git__rethrow(error, "Failed to open remote"); + t->repo = repo; + error = store_refs(t); if (error < GIT_SUCCESS) return git__rethrow(error, "Failed to retrieve references"); - t->repo = repo; t->parent.connected = 1; return GIT_SUCCESS; |
