@matheusbsbs / matheus-bagliano / commits / 4be636f42c
Fork 0

provide more errors for the "merge into empty head" case

A squash merge into an unborn branch could be implemented by building the index from the merged-from branch, and doing a single commit, but this is not supported yet. A non-fast-forward merge into an unborn branch does not make any sense, because you cannot make a merge commit if you don't have a commit to use as the parent. Signed-off-by: Paolo Bonzini <bonzini@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Paolo Bonzini committed Aug 21, 2008 at 14:14 UTC 4be636f42cd75f865204817c307eb1a7b464109c
1 file changed +5
builtin-merge.c
+5
@@ -833,6 +833,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
833 if (argc != 1)
834 die("Can merge only exactly one commit into "
835 "empty head");
836 + if (squash)
837 + die("Squash commit into empty head not supported yet");
838 + if (!allow_fast_forward)
839 + die("Non-fast-forward commit does not make sense into "
840 + "an empty head");
841 remote_head = peel_to_type(argv[0], 0, NULL, OBJ_COMMIT);
842 if (!remote_head)
843 die("%s - not something we can merge", argv[0]);