Skip to content

Commit f665d63

Browse files
HebaWalygitster
authored andcommitted
tag: use new advice API to check visibility
change the advise call in tag library from advise() to advise_if_enabled() to construct an example of the usage of the new API. Signed-off-by: Heba Waly <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b3b18d1 commit f665d63

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

advice.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ int advice_ignored_hook = 1;
2929
int advice_waiting_for_editor = 1;
3030
int advice_graft_file_deprecated = 1;
3131
int advice_checkout_ambiguous_remote_branch_name = 1;
32-
int advice_nested_tag = 1;
3332
int advice_submodule_alternate_error_strategy_die = 1;
3433

3534
static int advice_use_color = -1;
@@ -89,7 +88,6 @@ static struct {
8988
{ "waitingForEditor", &advice_waiting_for_editor },
9089
{ "graftFileDeprecated", &advice_graft_file_deprecated },
9190
{ "checkoutAmbiguousRemoteBranchName", &advice_checkout_ambiguous_remote_branch_name },
92-
{ "nestedTag", &advice_nested_tag },
9391
{ "submoduleAlternateErrorStrategyDie", &advice_submodule_alternate_error_strategy_die },
9492

9593
/* make this an alias for backward compatibility */

advice.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ extern int advice_ignored_hook;
2929
extern int advice_waiting_for_editor;
3030
extern int advice_graft_file_deprecated;
3131
extern int advice_checkout_ambiguous_remote_branch_name;
32-
extern int advice_nested_tag;
3332
extern int advice_submodule_alternate_error_strategy_die;
3433

3534
/*

builtin/tag.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,9 @@ static void create_tag(const struct object_id *object, const char *object_ref,
231231
if (type <= OBJ_NONE)
232232
die(_("bad object type."));
233233

234-
if (type == OBJ_TAG && advice_nested_tag)
235-
advise(_(message_advice_nested_tag), tag, object_ref);
234+
if (type == OBJ_TAG)
235+
advise_if_enabled(ADVICE_NESTED_TAG, _(message_advice_nested_tag),
236+
tag, object_ref);
236237

237238
strbuf_addf(&header,
238239
"object %s\n"

t/t7004-tag.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,7 @@ test_expect_success 'recursive tagging should give advice' '
17261726
hint: already a tag. If you meant to tag the object that it points to, use:
17271727
hint: |
17281728
hint: git tag -f nested annotated-v4.0^{}
1729+
hint: Disable this message with "git config advice.nestedTag false"
17291730
EOF
17301731
git tag -m nested nested annotated-v4.0 2>actual &&
17311732
test_i18ncmp expect actual

0 commit comments

Comments
 (0)