summaryrefslogtreecommitdiffstats
path: root/git.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-02-09 00:17:31 +0100
committerJunio C Hamano <gitster@pobox.com>2024-02-13 21:53:15 +0100
commitc784b0a5b991cc8ee179b8f3a8fc0b762708947d (patch)
tree36c154cc3827d6d96cc9e2917052189b7c2987b6 /git.c
parentGit 2.43 (diff)
downloadgit-c784b0a5b991cc8ee179b8f3a8fc0b762708947d.tar.xz
git-c784b0a5b991cc8ee179b8f3a8fc0b762708947d.zip
git: --no-lazy-fetch option
Sometimes, especially during tests of low level machinery, it is handy to have a way to disable lazy fetching of objects. This allows us to say, for example, "git cat-file -e <object-name>", to see if the object is locally available. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git.c')
-rw-r--r--git.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/git.c b/git.c
index c67e44dd82..28e8bf7497 100644
--- a/git.c
+++ b/git.c
@@ -4,6 +4,7 @@
#include "exec-cmd.h"
#include "gettext.h"
#include "help.h"
+#include "object-file.h"
#include "pager.h"
#include "read-cache-ll.h"
#include "run-command.h"
@@ -186,6 +187,8 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
use_pager = 0;
if (envchanged)
*envchanged = 1;
+ } else if (!strcmp(cmd, "--no-lazy-fetch")) {
+ fetch_if_missing = 0;
} else if (!strcmp(cmd, "--no-replace-objects")) {
disable_replace_refs();
setenv(NO_REPLACE_OBJECTS_ENVIRONMENT, "1", 1);