Commit c5b2622d6810eed5a4b90123ab0e7fc6d4583831

Carlos Martín Nieto 2011-06-23T16:32:06

Add git_refspec_transform test Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>

diff --git a/tests/t16-remotes.c b/tests/t16-remotes.c
index 43f5c96..4bc2f55 100644
--- a/tests/t16-remotes.c
+++ b/tests/t16-remotes.c
@@ -79,8 +79,28 @@ BEGIN_TEST(refspec1, "remote fnmatch works as expected")
 	git_repository_free(repo);
 END_TEST
 
+BEGIN_TEST(refspec2, "refspec transform")
+	git_remote *remote;
+	git_repository *repo;
+	git_config *cfg;
+	const git_refspec *refspec = NULL;
+	char ref[1024] = {0};
+
+	must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
+	must_pass(git_repository_config(&cfg, repo, NULL, NULL));
+	must_pass(git_remote_get(&remote, cfg, "test"));
+	refspec = git_remote_fetchspec(remote);
+	must_be_true(refspec != NULL);
+	must_pass(git_refspec_transform(ref, sizeof(ref), refspec, "refs/heads/master"));
+	must_be_true(!strcmp(ref, "refs/remotes/test/master"));
+	git_remote_free(remote);
+	git_config_free(cfg);
+	git_repository_free(repo);
+END_TEST
+
 BEGIN_SUITE(remotes)
 	 ADD_TEST(remotes0)
 	 ADD_TEST(refspec0)
 	 ADD_TEST(refspec1)
+	 ADD_TEST(refspec2)
 END_SUITE