summaryrefslogtreecommitdiff
path: root/builtin-revert.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-01-10 22:49:35 -0800
committerJunio C Hamano <gitster@pobox.com>2008-02-05 00:39:19 -0800
commit45525bd022dda75ec935c9c579e452577dcfd31f (patch)
tree9928dc5906a9af8a7adbc54e6340cd4286ba3a1b /builtin-revert.c
parent7a2078b4b00fb1c5d7b0bf8155778f79377b8f2f (diff)
downloadgit-45525bd022dda75ec935c9c579e452577dcfd31f.tar.gz
Make error messages from cherry-pick/revert more sensible
The original "rewrite in C" did somewhat a sloppy job while stealing code from git-write-tree. The caller pretends as if the write_tree() function would return an error code and being able to issue a sensible error message itself, but write_tree() function just calls die() and never returns an error. Worse yet, the function claims that it was running git-write-tree (which is no longer true after cherry-pick stole it). Tested-by: Björn Steinbrink <B.Steinbrink@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-revert.c')
-rw-r--r--builtin-revert.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin-revert.c b/builtin-revert.c
index 358af53747..e219859f9b 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;) {