Merge 'kn/for-each-tag-branch' into kn/for-each-tag
[gitweb.git] / builtin / tag.c
index 071d001655c754b502ddcdf6f1625a053e32fa46..471d6b1ab8847d7344483509633d3067c088bf6d 100644 (file)
@@ -571,6 +571,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
        struct create_tag_options opt;
        char *cleanup_arg = NULL;
        int annotate = 0, force = 0, lines = -1;
+       int create_reflog = 0;
        int cmdmode = 0;
        const char *msgfile = NULL, *keyid = NULL;
        struct msg_arg msg = { 0, STRBUF_INIT };
@@ -597,6 +598,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
                OPT_STRING('u', "local-user", &keyid, N_("key-id"),
                                        N_("use another key to sign the tag")),
                OPT__FORCE(&force, N_("replace the tag if exists")),
+               OPT_BOOL(0, "create-reflog", &create_reflog, N_("create_reflog")),
 
                OPT_GROUP(N_("Tag listing options")),
                OPT_COLUMN(0, "column", &colopts, N_("show tag list in columns")),
@@ -715,7 +717,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
        transaction = ref_transaction_begin(&err);
        if (!transaction ||
            ref_transaction_update(transaction, ref.buf, object, prev,
-                                  0, NULL, &err) ||
+                                  create_reflog ? REF_FORCE_CREATE_REFLOG : 0,
+                                  NULL, &err) ||
            ref_transaction_commit(transaction, &err))
                die("%s", err.buf);
        ref_transaction_free(transaction);