summaryrefslogtreecommitdiff
path: root/tests-clar/network
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2012-01-31 17:21:49 +0100
committerCarlos Martín Nieto <carlos@cmartin.tk>2012-01-31 17:29:53 +0100
commit279afd2a514160754eeba8e5db84600486f70761 (patch)
tree418280985b624d9b005db6a1ec9d56c5efda3329 /tests-clar/network
parentf25cc58d5cd630aa379bf894c5b78feb824bb647 (diff)
downloadlibgit2-279afd2a514160754eeba8e5db84600486f70761.tar.gz
refspec: a ref name includes the refs/ prefix
git_refspec_transform_r assumed that the reference name passed would be only a branch or tag name. This is not the case, and we need to take into consideration what's in the refspec's source to know how much of the prefix to ignore.
Diffstat (limited to 'tests-clar/network')
-rw-r--r--tests-clar/network/remotes.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests-clar/network/remotes.c b/tests-clar/network/remotes.c
index 2abaccb07..a0a940fc9 100644
--- a/tests-clar/network/remotes.c
+++ b/tests-clar/network/remotes.c
@@ -1,4 +1,6 @@
#include "clar_libgit2.h"
+#include "buffer.h"
+#include "refspec.h"
static git_remote *_remote;
static git_repository *_repo;
@@ -48,3 +50,11 @@ void test_network_remotes__transform(void)
cl_git_pass(git_refspec_transform(ref, sizeof(ref), _refspec, "refs/heads/master"));
cl_assert(!strcmp(ref, "refs/remotes/test/master"));
}
+
+void test_network_remotes__transform_r(void)
+{
+ git_buf buf = GIT_BUF_INIT;
+
+ cl_git_pass(git_refspec_transform_r(&buf, _refspec, "refs/heads/master"));
+ cl_assert(!strcmp(git_buf_cstr(&buf), "refs/remotes/test/master"));
+}