path: root/builtin/tag.c
diff options
authorPhil Hord <>2013-03-12 23:13:41 (GMT)
committerJunio C Hamano <>2013-03-13 17:35:15 (GMT)
commit3ae851e6fbb4e99fa7281d18a5c6f95a3fb6d998 (patch)
tree8d9a4a19d6916b1b6c9f9e5484f1d7851ecc8c7f /builtin/tag.c
parent03a0fb0ccf48c831060c2243f830b6a12cd8fdf3 (diff)
tag: --force does not have to warn when creating tags
"git tag --force" mentions what old tag object is being replaced when it is used to update an existing tag, but it shows the same message when creating a new one. Stop doing that, as it does not add any information. Add a test for this and also to ensure --force can replace tags at all. Signed-off-by: Phil Hord <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/tag.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/tag.c b/builtin/tag.c
index 9c3e067..d482480 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -584,7 +584,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
die(_("%s: cannot lock the ref"), ref.buf);
if (write_ref_sha1(lock, object, NULL) < 0)
die(_("%s: cannot update the ref"), ref.buf);
- if (force && hashcmp(prev, object))
+ if (force && !is_null_sha1(prev) && hashcmp(prev, object))
printf(_("Updated tag '%s' (was %s)\n"), tag, find_unique_abbrev(prev, DEFAULT_ABBREV));