Merge branch 'nd/remote-update-doc'
[gitweb.git] / builtin / difftool.c
index b2d3ba7539d5b9cdc7ec6f910ee24510e709f76c..bc97d4aef2db2d76e3ffddfc4759e52688f3974e 100644 (file)
@@ -15,7 +15,7 @@
 #include "config.h"
 #include "builtin.h"
 #include "run-command.h"
-#include "exec_cmd.h"
+#include "exec-cmd.h"
 #include "parse-options.h"
 #include "argv-array.h"
 #include "strbuf.h"
@@ -306,7 +306,7 @@ static char *get_symlink(const struct object_id *oid, const char *path)
        } else {
                enum object_type type;
                unsigned long size;
-               data = read_sha1_file(oid->hash, &type, &size);
+               data = read_object_file(oid, &type, &size);
                if (!data)
                        die(_("could not read object %s for symlink %s"),
                                oid_to_hex(oid), path);
@@ -610,13 +610,12 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
                        continue;
 
                if (!indices_loaded) {
-                       static struct lock_file lock;
+                       struct lock_file lock = LOCK_INIT;
                        strbuf_reset(&buf);
                        strbuf_addf(&buf, "%s/wtindex", tmpdir);
                        if (hold_lock_file_for_update(&lock, buf.buf, 0) < 0 ||
                            write_locked_index(&wtindex, &lock, COMMIT_LOCK)) {
                                ret = error("could not write %s", buf.buf);
-                               rollback_lock_file(&lock);
                                goto finish;
                        }
                        changed_files(&wt_modified, buf.buf, workdir);
@@ -696,12 +695,11 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
                         N_("use `diff.guitool` instead of `diff.tool`")),
                OPT_BOOL('d', "dir-diff", &dir_diff,
                         N_("perform a full-directory diff")),
-               { OPTION_SET_INT, 'y', "no-prompt", &prompt, NULL,
+               OPT_SET_INT_F('y', "no-prompt", &prompt,
                        N_("do not prompt before launching a diff tool"),
-                       PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, 0},
-               { OPTION_SET_INT, 0, "prompt", &prompt, NULL, NULL,
-                       PARSE_OPT_NOARG | PARSE_OPT_NONEG | PARSE_OPT_HIDDEN,
-                       NULL, 1 },
+                       0, PARSE_OPT_NONEG),
+               OPT_SET_INT_F(0, "prompt", &prompt, NULL,
+                       1, PARSE_OPT_NONEG | PARSE_OPT_HIDDEN),
                OPT_BOOL(0, "symlinks", &symlinks,
                         N_("use symlinks in dir-diff mode")),
                OPT_STRING('t', "tool", &difftool_cmd, N_("<tool>"),