summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-05-30 00:27:22 +0200
committernulltoken <emeric.fermas@gmail.com>2012-05-30 01:05:17 +0200
commitd05e2c64dd93da7219c9ebca18c2f3b8478ca93a (patch)
treedcb6e7f324084e08e812ce96272ee5985fe94514 /src
parent1835c51f58a670e23c9546f942259d53fe626fa2 (diff)
downloadlibgit2-d05e2c64dd93da7219c9ebca18c2f3b8478ca93a.tar.gz
refspec: expose the force update specifier through git_refspec_force() accessor
Diffstat (limited to 'src')
-rw-r--r--src/refspec.c7
-rw-r--r--src/remote.c4
2 files changed, 11 insertions, 0 deletions
diff --git a/src/refspec.c b/src/refspec.c
index 697b1bf87..b6b1158b7 100644
--- a/src/refspec.c
+++ b/src/refspec.c
@@ -53,6 +53,13 @@ const char *git_refspec_dst(const git_refspec *refspec)
return refspec == NULL ? NULL : refspec->dst;
}
+int git_refspec_force(const git_refspec *refspec)
+{
+ assert(refspec);
+
+ return refspec->force;
+}
+
int git_refspec_src_matches(const git_refspec *refspec, const char *refname)
{
if (refspec == NULL || refspec->src == NULL)
diff --git a/src/remote.c b/src/remote.c
index 9740344f8..deb73508d 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -189,6 +189,8 @@ int git_remote_save(const git_remote *remote)
git_buf_clear(&buf);
git_buf_clear(&value);
git_buf_printf(&buf, "remote.%s.fetch", remote->name);
+ if (remote->fetch.force)
+ git_buf_putc(&value, '+');
git_buf_printf(&value, "%s:%s", remote->fetch.src, remote->fetch.dst);
if (git_buf_oom(&buf) || git_buf_oom(&value))
return -1;
@@ -201,6 +203,8 @@ int git_remote_save(const git_remote *remote)
git_buf_clear(&buf);
git_buf_clear(&value);
git_buf_printf(&buf, "remote.%s.push", remote->name);
+ if (remote->push.force)
+ git_buf_putc(&value, '+');
git_buf_printf(&value, "%s:%s", remote->push.src, remote->push.dst);
if (git_buf_oom(&buf) || git_buf_oom(&value))
return -1;