checkout: convert read_tree_some to take struct pathspec
[gitweb.git] / builtin / update-index.c
index 74986bf163d4dadb4497a90364c29ac71a801638..e79581879946e769a58c124e4a076efaf75df86c 100644 (file)
@@ -11,6 +11,7 @@
 #include "refs.h"
 #include "resolve-undo.h"
 #include "parse-options.h"
+#include "pathspec.h"
 
 /*
  * Default to not allowing changes to the list of files. The
@@ -546,10 +547,11 @@ static int do_reupdate(int ac, const char **av,
         */
        int pos;
        int has_head = 1;
-       const char **paths = get_pathspec(prefix, av + 1);
        struct pathspec pathspec;
 
-       init_pathspec(&pathspec, paths);
+       parse_pathspec(&pathspec, 0,
+                      PATHSPEC_PREFER_CWD,
+                      prefix, av + 1);
 
        if (read_ref("HEAD", head_sha1))
                /* If there is no HEAD, that means it is an initial
@@ -593,6 +595,7 @@ struct refresh_params {
 static int refresh(struct refresh_params *o, unsigned int flag)
 {
        setup_work_tree();
+       read_cache_preload(NULL);
        *o->has_errors |= refresh_cache(o->flags | flag);
        return 0;
 }
@@ -795,7 +798,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
        };
 
        if (argc == 2 && !strcmp(argv[1], "-h"))
-               usage(update_index_usage[0]);
+               usage_with_options(update_index_usage, options);
 
        git_config(git_default_config, NULL);