#include "builtin.h"
+#include "parse-options.h"
#include "tag.h"
#include "replace-object.h"
#include "object-store.h"
#include "fsck.h"
#include "config.h"
+static char const * const builtin_mktag_usage[] = {
+ N_("git mktag"),
+ NULL
+};
+
static struct fsck_options fsck_options = FSCK_OPTIONS_STRICT;
static int mktag_config(const char *var, const char *value, void *cb)
int cmd_mktag(int argc, const char **argv, const char *prefix)
{
+ static struct option builtin_mktag_options[] = {
+ OPT_END(),
+ };
struct strbuf buf = STRBUF_INIT;
struct object_id tagged_oid;
int tagged_type;
struct object_id result;
- if (argc != 1)
- usage("git mktag");
+ argc = parse_options(argc, argv, NULL,
+ builtin_mktag_options,
+ builtin_mktag_usage, 0);
if (strbuf_read(&buf, 0, 0) < 0)
die_errno("could not read from stdin");
blob=$(git rev-parse --verify HEAD:B.t)
'
+test_expect_success 'basic usage' '
+ cat >tag.sig <<-EOF &&
+ object $head
+ type commit
+ tag mytag
+ tagger T A Gger <tagger@example.com> 1206478233 -0500
+ EOF
+ git mktag <tag.sig &&
+ git mktag --end-of-options <tag.sig &&
+ test_expect_code 129 git mktag --unknown-option
+'
+
############################################################
# 1. length check