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>
Junio C Hamano committed
Feb 8, 2024 at 15:17 UTC
c784b0a5b991cc8ee179b8f3a8fc0b762708947d
2 files changed
+8
Documentation/git.txt
+5
@@ -177,6 +177,11 @@ If you just want to run git as if it was started in `<path>` then use
177
Do not use replacement refs to replace Git objects. See
178
linkgit:git-replace[1] for more information.
179
180
+--no-lazy-fetch::
181
+ Do not fetch missing objects from the promisor remote on
182
+ demand. Useful together with `git cat-file -e <object>` to
183
+ see if the object is locally available.
184
+
185
--literal-pathspecs::
186
Treat pathspecs literally (i.e. no globbing, no pathspec magic).
187
This is equivalent to setting the `GIT_LITERAL_PATHSPECS` environment
git.c
+3
@@ -4,6 +4,7 @@
4
#include "exec-cmd.h"
5
#include "gettext.h"
6
#include "help.h"
7
+#include "object-file.h"
8
#include "pager.h"
9
#include "read-cache-ll.h"
10
#include "run-command.h"
@@ -186,6 +187,8 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
187
use_pager = 0;
188
if (envchanged)
189
*envchanged = 1;
190
+ } else if (!strcmp(cmd, "--no-lazy-fetch")) {
191
+ fetch_if_missing = 0;
192
} else if (!strcmp(cmd, "--no-replace-objects")) {
193
disable_replace_refs();
194
setenv(NO_REPLACE_OBJECTS_ENVIRONMENT, "1", 1);