git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/1] sparse-checkout: use extern for global variables

From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Date
Dec 31, 2019, 13:17 UTC
Message-ID
<c704cb554e1897278913520f266d95a4b04f9639.1577798268.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.506.git.1577798268.gitgitgadget@gmail.com>
From: Derrick Stolee <dstolee@microsoft.com>

When the core.sparseCheckoutCone config setting was added in 879321eb0b ("sparse-checkout: add 'cone' mode" 2019-11-21), the variables storing the config values for core.sparseCheckout and core.sparseCheckoutCone were rearranged in cache.h, but in doing so the "extern" keyword was dropped.

While we are tending to drop the "extern" keyword for function declarations, it is still necessary for global variables used across multiple *.c files. The impact of not having the extern keyword may be unpredictable.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
 cache.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cache.h b/cache.h
index 1554488d66..cbfaead23a 100644
--- a/cache.h
+++ b/cache.h
@@ -958,8 +958,8 @@ extern int protect_hfs;
 extern int protect_ntfs;
 extern const char *core_fsmonitor;
 
-int core_apply_sparse_checkout;
-int core_sparse_checkout_cone;
+extern int core_apply_sparse_checkout;
+extern int core_sparse_checkout_cone;
 
 /*
  * Include broken refs in all ref iterations, which will
-- 
gitgitgadget
Previous: Derrick Stolee via GitGitGadgetNext: Junio C Hamano
Message 2 of 3 in “sparse-checkout: use extern for global variables”
  1. 0/1 sparse-checkout: use extern for global variablesDerrick Stolee via GitGitGadget, Dec 31, 2019
  2. 1/1 sparse-checkout: use extern for global variablesDerrick Stolee via GitGitGadget, Dec 31, 2019
  3. Junio C HamanoJan 2, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.