Commit Diff


commit - b3dc731fefb8046ff69090a0ccdb97bef71aaf65
commit + 726fb9002b2e7771cda3f3d5cc94684cc6369949
blob - 71ee12e8b498271db30de124a1e7955985cf8129
blob + a1411592681076c2aecbb0ca5517c9c3c2971ea2
--- lib/fetch.c
+++ lib/fetch.c
@@ -120,8 +120,6 @@ got_fetch_pack(struct got_object_id **pack_hash, struc
 	off_t packfile_size = 0;
 	struct got_packfile_hdr pack_hdr;
 	uint32_t nobj = 0;
-	char *ref_prefix = NULL;
-	size_t ref_prefixlen = 0;
 	char *path;
 	char *progress = NULL;
 
@@ -149,13 +147,6 @@ got_fetch_pack(struct got_object_id **pack_hash, struc
 	TAILQ_INIT(&have_refs);
 	TAILQ_INIT(&my_refs);
 
-	if (!mirror_references) {
-		if (asprintf(&ref_prefix, "refs/remotes/%s/",
-		    remote_name) == -1)
-			return got_error_from_errno("asprintf");
-		ref_prefixlen = strlen(ref_prefix);
-	}
-
 	if (!list_refs_only) {
 		err = got_ref_list(&my_refs, repo, NULL,
 		    got_ref_cmp_by_name, NULL);
@@ -170,60 +161,17 @@ got_fetch_pack(struct got_object_id **pack_hash, struc
 		if (got_ref_is_symbolic(re->ref))
 			continue;
 
-		refname = got_ref_get_name(re->ref);
-
-		if (mirror_references) {
-			char *name;
-			err = got_ref_resolve(&id, repo, re->ref);
-			if (err)
-				goto done;
-			name = strdup(refname);
-			if (name == NULL) {
-				err = got_error_from_errno("strdup");
-				goto done;
-			}
-			err = got_pathlist_append(&have_refs, name, id);
-			if (err)
-				goto done;
-			continue;
+		err = got_ref_resolve(&id, repo, re->ref);
+		if (err)
+			goto done;
+		refname = strdup(got_ref_get_name(re->ref));
+		if (refname == NULL) {
+			err = got_error_from_errno("strdup");
+			goto done;
 		}
-
-		if (strncmp("refs/tags/", refname, 10) == 0) {
-			char *tagname;
-
-			err = got_ref_resolve(&id, repo, re->ref);
-			if (err)
-				goto done;
-			tagname = strdup(refname);
-			if (tagname == NULL) {
-				err = got_error_from_errno("strdup");
-				goto done;
-			}
-			err = got_pathlist_append(&have_refs, tagname, id);
-			if (err) {
-				free(tagname);
-				goto done;
-			}
-		}
-
-		if (strncmp(ref_prefix, refname, ref_prefixlen) == 0) {
-			char *branchname;
-
-			err = got_ref_resolve(&id, repo, re->ref);
-			if (err)
-				goto done;
-
-			if (asprintf(&branchname, "refs/heads/%s",
-			    refname + ref_prefixlen) == -1) {
-				err = got_error_from_errno("asprintf");
-				goto done;
-			}
-			err = got_pathlist_append(&have_refs, branchname, id);
-			if (err) {
-				free(branchname);
-				goto done;
-			}
-		}
+		err = got_pathlist_append(&have_refs, refname, id);
+		if (err)
+			goto done;
 	}
 
 	if (list_refs_only) {
@@ -573,7 +521,6 @@ done:
 	free(tmpidxpath);
 	free(idxpath);
 	free(packpath);
-	free(ref_prefix);
 	free(progress);
 
 	TAILQ_FOREACH(pe, &have_refs, entry) {