Code

everyday: use the dashless form of git-init
[git.git] / builtin-update-index.c
index e5bb2a03cbc047392b866ad1128cba58f98af5ba..9d19c51e8e68d5d4c92465699c58ef0acec70209 100644 (file)
@@ -14,7 +14,7 @@
  * Default to not allowing changes to the list of files. The
  * tool doesn't actually care, but this makes it harder to add
  * files to the revision control by mistake by doing something
- * like "git-update-index *" and suddenly having all the object
+ * like "git update-index *" and suddenly having all the object
  * files be revision controlled.
  */
 static int allow_add;
@@ -310,18 +310,18 @@ static void read_index_info(int line_termination)
                /* This reads lines formatted in one of three formats:
                 *
                 * (1) mode         SP sha1          TAB path
-                * The first format is what "git-apply --index-info"
+                * The first format is what "git apply --index-info"
                 * reports, and used to reconstruct a partial tree
                 * that is used for phony merge base tree when falling
                 * back on 3-way merge.
                 *
                 * (2) mode SP type SP sha1          TAB path
-                * The second format is to stuff git-ls-tree output
+                * The second format is to stuff "git ls-tree" output
                 * into the index file.
                 *
                 * (3) mode         SP sha1 SP stage TAB path
                 * This format is to put higher order stages into the
-                * index file and matches git-ls-files --stage output.
+                * index file and matches "git ls-files --stage" output.
                 */
                errno = 0;
                ul = strtoul(buf.buf, &ptr, 8);
@@ -614,10 +614,12 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
                                continue;
                        }
                        if (!strcmp(path, "--refresh")) {
+                               setup_work_tree();
                                has_errors |= refresh_cache(refresh_flags);
                                continue;
                        }
                        if (!strcmp(path, "--really-refresh")) {
+                               setup_work_tree();
                                has_errors |= refresh_cache(REFRESH_REALLY | refresh_flags);
                                continue;
                        }
@@ -684,6 +686,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
                                goto finish;
                        }
                        if (!strcmp(path, "--again") || !strcmp(path, "-g")) {
+                               setup_work_tree();
                                has_errors = do_reupdate(argc - i, argv + i,
                                                         prefix, prefix_length);
                                if (has_errors)
@@ -702,6 +705,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
                                usage(update_index_usage);
                        die("unknown option %s", path);
                }
+               setup_work_tree();
                p = prefix_path(prefix, prefix_length, path);
                update_one(p, NULL, 0);
                if (set_executable_bit)
@@ -714,6 +718,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
 
                strbuf_init(&buf, 0);
                strbuf_init(&nbuf, 0);
+               setup_work_tree();
                while (strbuf_getline(&buf, stdin, line_termination) != EOF) {
                        const char *p;
                        if (line_termination && buf.buf[0] == '"') {