summaryrefslogtreecommitdiff
path: root/src/refs.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-02-04 22:04:00 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2014-02-05 12:07:56 +0100
commit911236619b5d774e33dd9f3de92a7c86c2befb26 (patch)
tree528d64a959077a604232980cc092f92d04f0e13f /src/refs.c
parentd6236cf662ebd4ba8ef4902c81a19bbfd92847f9 (diff)
downloadlibgit2-911236619b5d774e33dd9f3de92a7c86c2befb26.tar.gz
refdb: add conditional symbolic updates
Add a parameter to the backend to allow checking for the old symbolic target.
Diffstat (limited to 'src/refs.c')
-rw-r--r--src/refs.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/refs.c b/src/refs.c
index 007fdf353..888b5cb3c 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -332,7 +332,8 @@ static int reference__create(
int force,
const git_signature *signature,
const char *log_message,
- const git_oid *old_id)
+ const git_oid *old_id,
+ const char *old_target)
{
char normalized[GIT_REFNAME_MAX];
git_refdb *refdb;
@@ -381,7 +382,7 @@ static int reference__create(
GITERR_CHECK_ALLOC(ref);
- if ((error = git_refdb_write(refdb, ref, force, signature, log_message, old_id)) < 0) {
+ if ((error = git_refdb_write(refdb, ref, force, signature, log_message, old_id, old_target)) < 0) {
git_reference_free(ref);
return error;
}
@@ -431,7 +432,7 @@ int git_reference_create_matching(
}
error = reference__create(
- ref_out, repo, name, id, NULL, force, signature, log_message, old_id);
+ ref_out, repo, name, id, NULL, force, signature, log_message, old_id, NULL);
git_signature_free(who);
return error;
@@ -471,7 +472,7 @@ int git_reference_symbolic_create(
}
error = reference__create(
- ref_out, repo, name, NULL, target, force, signature, log_message, NULL);
+ ref_out, repo, name, NULL, target, force, signature, log_message, NULL, NULL);
git_signature_free(who);
return error;