X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-revert.c;h=b6dee6a56c21be816725a4366f448dac98e62ae6;hb=340814636dde3cbd2e461b12f9ae832d2100766a;hp=4bf8eb2f58ac5a81a9d6538e31f2da661db4c3e9;hpb=ab7d70766963e1e854a1edcbb0b840242330a7cb;p=git.git diff --git a/builtin-revert.c b/builtin-revert.c index 4bf8eb2f5..b6dee6a56 100644 --- a/builtin-revert.c +++ b/builtin-revert.c @@ -8,6 +8,7 @@ #include "exec_cmd.h" #include "utf8.h" #include "parse-options.h" +#include "cache-tree.h" /* * This implements the builtins revert and cherry-pick. @@ -270,7 +271,7 @@ static int revert_or_cherry_pick(int argc, const char **argv) * that represents the "current" state for merge-recursive * to work on. */ - if (write_tree(head, 0, NULL)) + if (write_cache_as_tree(head, 0, NULL)) die ("Your index file is unmerged."); } else { struct wt_status s; @@ -357,7 +358,7 @@ static int revert_or_cherry_pick(int argc, const char **argv) if (merge_recursive(sha1_to_hex(base->object.sha1), sha1_to_hex(head), "HEAD", sha1_to_hex(next->object.sha1), oneline) || - write_tree(head, 0, NULL)) { + write_cache_as_tree(head, 0, NULL)) { add_to_msg("\nConflicts:\n\n"); read_cache(); for (i = 0; i < active_nr;) { @@ -371,13 +372,13 @@ static int revert_or_cherry_pick(int argc, const char **argv) i++; } } - if (close(msg_fd) || commit_lock_file(&msg_file) < 0) + if (commit_lock_file(&msg_file) < 0) die ("Error wrapping up %s", defmsg); fprintf(stderr, "Automatic %s failed.%s\n", me, help_msg(commit->object.sha1)); exit(1); } - if (close(msg_fd) || commit_lock_file(&msg_file) < 0) + if (commit_lock_file(&msg_file) < 0) die ("Error wrapping up %s", defmsg); fprintf(stderr, "Finished one %s.\n", me); @@ -396,8 +397,7 @@ static int revert_or_cherry_pick(int argc, const char **argv) else return execl_git_cmd("commit", "-n", "-F", defmsg, NULL); } - if (reencoded_message) - free(reencoded_message); + free(reencoded_message); return 0; }