git/t/helper/test-advise.c
Ævar Arnfjörð Bjarmason 927dc33070 advice.h: add missing __attribute__((format)) & fix usage
Add the missing __attribute__((format)) checking to
advise_if_enabled(). This revealed a trivial issue introduced in
b3b18d1621 (advice: revamp advise API, 2020-03-02). We treated the
argv[1] as a format string, but did not intend to do so. Let's use
"%s" and pass argv[1] as an argument instead.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-07-13 15:20:20 -07:00

23 lines
474 B
C

#include "test-tool.h"
#include "cache.h"
#include "advice.h"
#include "config.h"
int cmd__advise_if_enabled(int argc, const char **argv)
{
if (argc != 2)
die("usage: %s <advice>", argv[0]);
setup_git_directory();
git_config(git_default_config, NULL);
/*
* Any advice type can be used for testing, but NESTED_TAG was
* selected here and in t0018 where this command is being
* executed.
*/
advise_if_enabled(ADVICE_NESTED_TAG, "%s", argv[1]);
return 0;
}