X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-update-ref.c;h=76ba1d5881b3cddc527bd363dec340c83dde605f;hb=900a5d075e8b48025439966dc3863189874bae3b;hp=d90d11d2e35c38baab32f05f58125aaf1baee6cc;hpb=7ed3fed33dd71adad863d350b7a501a12cb94d07;p=git.git diff --git a/builtin-update-ref.c b/builtin-update-ref.c index d90d11d2e..76ba1d588 100644 --- a/builtin-update-ref.c +++ b/builtin-update-ref.c @@ -4,8 +4,8 @@ #include "parse-options.h" static const char * const git_update_ref_usage[] = { - "git-update-ref [options] -d []", - "git-update-ref [options] []", + "git update-ref [options] -d []", + "git update-ref [options] []", NULL }; @@ -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"), @@ -23,7 +23,8 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix) }; git_config(git_default_config, NULL); - argc = parse_options(argc, argv, options, git_update_ref_usage, 0); + argc = parse_options(argc, argv, prefix, options, git_update_ref_usage, + 0); if (msg && !*msg) die("Refusing to perform update with empty message."); @@ -47,9 +48,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); }