Skip to content

Commit c784b0a

Browse files
committed
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 <[email protected]>
1 parent 564d025 commit c784b0a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Documentation/git.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ If you just want to run git as if it was started in `<path>` then use
177177
Do not use replacement refs to replace Git objects. See
178178
linkgit:git-replace[1] for more information.
179179

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+
180185
--literal-pathspecs::
181186
Treat pathspecs literally (i.e. no globbing, no pathspec magic).
182187
This is equivalent to setting the `GIT_LITERAL_PATHSPECS` environment

git.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "exec-cmd.h"
55
#include "gettext.h"
66
#include "help.h"
7+
#include "object-file.h"
78
#include "pager.h"
89
#include "read-cache-ll.h"
910
#include "run-command.h"
@@ -186,6 +187,8 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
186187
use_pager = 0;
187188
if (envchanged)
188189
*envchanged = 1;
190+
} else if (!strcmp(cmd, "--no-lazy-fetch")) {
191+
fetch_if_missing = 0;
189192
} else if (!strcmp(cmd, "--no-replace-objects")) {
190193
disable_replace_refs();
191194
setenv(NO_REPLACE_OBJECTS_ENVIRONMENT, "1", 1);

0 commit comments

Comments
 (0)