backfill: assume --sparse when sparse-checkout is enabled
The previous change introduced the '--[no-]sparse' option for the 'git backfill' command, but did not assume it as enabled by default. However, this is likely the behavior that users will most often want to happen. Without this default, users with a small sparse-checkout may be confused when 'git backfill' downloads every version of every object in the full history. However, this is left as a separate change so this decision can be reviewed independently of the value of the '--[no-]sparse' option. Add a test of adding the '--sparse' option to a repo without sparse-checkout to make it clear that supplying it without a sparse-checkout is an error. Signed-off-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
bff4555767
commit
85127bcdea
@ -1,3 +1,6 @@
|
||||
/* We need this macro to access core_apply_sparse_checkout */
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
|
||||
#include "builtin.h"
|
||||
#include "git-compat-util.h"
|
||||
#include "config.h"
|
||||
@ -5,6 +8,7 @@
|
||||
#include "repository.h"
|
||||
#include "commit.h"
|
||||
#include "dir.h"
|
||||
#include "environment.h"
|
||||
#include "hex.h"
|
||||
#include "tree.h"
|
||||
#include "tree-walk.h"
|
||||
@ -133,6 +137,9 @@ int cmd_backfill(int argc, const char **argv, const char *prefix, struct reposit
|
||||
|
||||
repo_config(repo, git_default_config, NULL);
|
||||
|
||||
if (ctx.sparse < 0)
|
||||
ctx.sparse = core_apply_sparse_checkout;
|
||||
|
||||
result = do_backfill(&ctx);
|
||||
backfill_context_clear(&ctx);
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user