Merge branch 'as/daemon-multi-listen'
[gitweb.git] / builtin / revert.c
index 5ca81580d37b20e6f65fc8e8d1cdf09228f33ca1..57b51e4a0e148062e1945d640b81559d65e4c2ba 100644 (file)
@@ -316,6 +316,13 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
        index_fd = hold_locked_index(&index_lock, 1);
 
        read_cache();
+
+       /*
+        * NEEDSWORK: cherry-picking between branches with
+        * different end-of-line normalization is a pain;
+        * plumb in an option to set o.renormalize?
+        * (or better: arbitrary -X options)
+        */
        init_merge_options(&o);
        o.ancestor = base ? base_label : "(empty tree)";
        o.branch1 = "HEAD";
@@ -435,7 +442,7 @@ static int do_pick_commit(void)
        else
                parent = commit->parents->item;
 
-       if (allow_ff && !hashcmp(parent->object.sha1, head))
+       if (allow_ff && parent && !hashcmp(parent->object.sha1, head))
                return fast_forward_to(commit->object.sha1, head);
 
        if (parent && parse_commit(parent) < 0)