diff mbox series

git.c: fix sparse warning

Message ID d9686e75-0792-33f7-dd70-3dc8ca6c4d66@ramsayjones.plus.com (mailing list archive)
State New, archived
Headers show
Series git.c: fix sparse warning | expand

Commit Message

Ramsay Jones June 1, 2020, 11:27 p.m. UTC
Commit 4acc44d720 (config: add setting to ignore sparsity patterns in
some cmds, 2020-05-27) adds an external symbol definition without a
corresponding external symbol declaration. This causes sparse to
complain: "symbol 'opt_restrict_to_sparse_paths' was not declared.
Should it be static?".

In order to suppress the warning, #include the 'sparse-checkout.h'
header file, which contains the required extern declaration.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---

Hi Matheus,

If you need to re-roll your 'mt/grep-sparse-checkout' branch, could you
please squash this into the relevant patch.

[This is the minimum fix - but I might be tempted to move the definition
of the variable to 'sparse-checkout.c' as well.]

Thanks!

ATB,
Ramsay Jones

 git.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Matheus Tavares June 3, 2020, 2:17 a.m. UTC | #1
On Mon, Jun 1, 2020 at 8:27 PM Ramsay Jones <ramsay@ramsayjones.plus.com> wrote:
>
>
> Commit 4acc44d720 (config: add setting to ignore sparsity patterns in
> some cmds, 2020-05-27) adds an external symbol definition without a
> corresponding external symbol declaration. This causes sparse to
> complain: "symbol 'opt_restrict_to_sparse_paths' was not declared.
> Should it be static?".
>
> In order to suppress the warning, #include the 'sparse-checkout.h'
> header file, which contains the required extern declaration.
>
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>
> Hi Matheus,
>
> If you need to re-roll your 'mt/grep-sparse-checkout' branch, could you
> please squash this into the relevant patch.

Sure! Thanks for catching this.
diff mbox series

Patch

diff --git a/git.c b/git.c
index 07de4363ef..6e62001f2f 100644
--- a/git.c
+++ b/git.c
@@ -5,6 +5,7 @@ 
 #include "run-command.h"
 #include "alias.h"
 #include "shallow.h"
+#include "sparse-checkout.h"
 
 #define RUN_SETUP		(1<<0)
 #define RUN_SETUP_GENTLY	(1<<1)