X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-update-ref.c;h=378dc1b7a6bb4d56d301a34a4d44dae2f9a37e44;hb=0f4dc14ac4945448f7309964afeb879d20408e07;hp=56a0b1b39cf4c4fc51dbbff256240655bc36a038;hpb=a0d74d160f3d416be8f7fbfd18fee0eebf40d8e0;p=git.git diff --git a/builtin-update-ref.c b/builtin-update-ref.c index 56a0b1b39..378dc1b7a 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); + 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); }