summaryrefslogtreecommitdiff
path: root/builtin-update-ref.c
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2008-10-26 03:33:58 +0100
committerJunio C Hamano <gitster@pobox.com>2008-10-26 14:44:25 -0700
commit569740bdd0533ef5cf032edd6233710161a35725 (patch)
treedb991b74ce167effab38b2477d2435e0506a0850 /builtin-update-ref.c
parent450d4c0f5a966b3f5835107ec4d8c344c8c25908 (diff)
downloadgit-569740bdd0533ef5cf032edd6233710161a35725.tar.gz
Fix git update-ref --no-deref -d.
Till now --no-deref was just ignored when deleting refs, fix this. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-update-ref.c')
-rw-r--r--builtin-update-ref.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/builtin-update-ref.c b/builtin-update-ref.c
index d8f3142c06..378dc1b7a6 100644
--- a/builtin-update-ref.c
+++ b/builtin-update-ref.c
@@ -13,7 +13,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
{
const char *refname, *oldval, *msg=NULL;
unsigned char sha1[20], oldsha1[20];
- int delete = 0, no_deref = 0;
+ int delete = 0, no_deref = 0, flags = 0;
struct option options[] = {
OPT_STRING( 'm', NULL, &msg, "reason", "reason of the update"),
OPT_BOOLEAN('d', NULL, &delete, "deletes the reference"),
@@ -47,9 +47,11 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
if (oldval && *oldval && get_sha1(oldval, oldsha1))
die("%s: not a valid old SHA1", oldval);
+ if (no_deref)
+ flags = REF_NODEREF;
if (delete)
- return delete_ref(refname, oldval ? oldsha1 : NULL, 0);
+ return delete_ref(refname, oldval ? oldsha1 : NULL, flags);
else
return update_ref(msg, refname, sha1, oldval ? oldsha1 : NULL,
- no_deref ? REF_NODEREF : 0, DIE_ON_ERR);
+ flags, DIE_ON_ERR);
}