Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/sparse-checkout.c')
-rw-r--r--builtin/sparse-checkout.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c
index fcf97e9df8..e3418fbe2a 100644
--- a/builtin/sparse-checkout.c
+++ b/builtin/sparse-checkout.c
@@ -102,6 +102,7 @@ static int sparse_checkout_init(int argc, const char **argv)
char *sparse_filename;
FILE *fp;
int res;
+ struct object_id oid;
if (set_config(MODE_ALL_PATTERNS))
return 1;
@@ -126,6 +127,11 @@ static int sparse_checkout_init(int argc, const char **argv)
fprintf(fp, "/*\n!/*/\n");
fclose(fp);
+ if (get_oid("HEAD", &oid)) {
+ /* assume we are in a fresh repo */
+ return 0;
+ }
+
reset_dir:
return update_working_directory();
}