]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/sparse-checkout.c
object-name.h: move declarations for object-name.c functions from cache.h
[thirdparty/git.git] / builtin / sparse-checkout.c
index 287716db68e4198bdec97517ff2cd9c053c9f0b8..34b9d92fb131eefe4295ac0aa79ae2883c3af036 100644 (file)
@@ -2,6 +2,9 @@
 #include "cache.h"
 #include "config.h"
 #include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "object-name.h"
 #include "parse-options.h"
 #include "pathspec.h"
 #include "repository.h"
 #include "unpack-trees.h"
 #include "wt-status.h"
 #include "quote.h"
+#include "setup.h"
 #include "sparse-index.h"
 #include "worktree.h"
 
 static const char *empty_base = "";
 
 static char const * const builtin_sparse_checkout_usage[] = {
-       N_("git sparse-checkout (init|list|set|add|reapply|disable) <options>"),
+       N_("git sparse-checkout (init | list | set | add | reapply | disable) [<options>]"),
        NULL
 };
 
@@ -218,14 +222,13 @@ static int update_working_directory(struct pattern_list *pl)
        o.src_index = r->index;
        o.dst_index = r->index;
        o.skip_sparse_checkout = 0;
-       o.pl = pl;
 
        setup_work_tree();
 
        repo_hold_locked_index(r, &lock_file, LOCK_DIE_ON_ERROR);
 
        setup_unpack_trees_porcelain(&o, "sparse-checkout");
-       result = update_sparsity(&o);
+       result = update_sparsity(&o, pl);
        clear_unpack_trees_porcelain(&o);
 
        if (result == UPDATE_SPARSITY_WARNINGS)
@@ -470,7 +473,7 @@ static int sparse_checkout_init(int argc, const char **argv, const char *prefix)
                return update_working_directory(NULL);
        }
 
-       if (get_oid("HEAD", &oid)) {
+       if (repo_get_oid(the_repository, "HEAD", &oid)) {
                FILE *fp;
 
                /* assume we are in a fresh repo, but update the sparse-checkout file */