summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-05-26 01:16:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-05-28 15:06:08 (GMT)
commit6035d6aad8ca11954c0d7821f6f3e7c047039c8f (patch)
treea24924b1323fe52278be3f912b36bc78eed7be22 /git.c
parent0781aa4766ed88d620ea060c7d775ca806ebfa93 (diff)
downloadgit-6035d6aad8ca11954c0d7821f6f3e7c047039c8f.zip
git-6035d6aad8ca11954c0d7821f6f3e7c047039c8f.tar.gz
git-6035d6aad8ca11954c0d7821f6f3e7c047039c8f.tar.bz2
fetch-pack: prepare updated shallow file before fetching the pack
index-pack --strict looks up and follows parent commits. If shallow information is not ready by the time index-pack is run, index-pack may be led to non-existent objects. Make fetch-pack save shallow file to disk before invoking index-pack. git learns new global option --shallow-file to pass on the alternate shallow file path. Undocumented (and not even support --shallow-file= syntax) because it's unlikely to be used again elsewhere. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git.c')
-rw-r--r--git.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/git.c b/git.c
index 1ada169..88eef5a 100644
--- a/git.c
+++ b/git.c
@@ -4,6 +4,7 @@
#include "help.h"
#include "quote.h"
#include "run-command.h"
+#include "commit.h"
const char git_usage_string[] =
"git [--version] [--help] [-c name=value]\n"
@@ -146,6 +147,12 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
setenv(GIT_LITERAL_PATHSPECS_ENVIRONMENT, "0", 1);
if (envchanged)
*envchanged = 1;
+ } else if (!strcmp(cmd, "--shallow-file")) {
+ (*argv)++;
+ (*argc)--;
+ set_alternate_shallow_file((*argv)[0]);
+ if (envchanged)
+ *envchanged = 1;
} else {
fprintf(stderr, "Unknown option: %s\n", cmd);
usage(git_usage_string);