From: Junio C Hamano Date: Thu, 15 Mar 2018 22:10:57 +0000 (-0700) Subject: Merge branch 'js/rebase-recreate-merge' into next X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/3d1671756f948dab40792285885f0298e561ee1b?ds=inline;hp=--cc Merge branch 'js/rebase-recreate-merge' into next "git rebase" learned "--recreate-merges" to transplant the whole topology of commit graph elsewhere. * js/rebase-recreate-merge: rebase -i: introduce --recreate-merges=[no-]rebase-cousins pull: accept --rebase=recreate to recreate the branch topology sequencer: handle post-rewrite for merge commands sequencer: make refs generated by the `label` command worktree-local rebase: introduce the --recreate-merges option rebase-helper --make-script: introduce a flag to recreate merges sequencer: fast-forward merge commits, if possible sequencer: introduce the `merge` command sequencer: introduce new commands to reset the revision git-rebase--interactive: clarify arguments sequencer: make rearrange_squash() a bit more obvious sequencer: avoid using errno clobbered by rollback_lock_file() --- 3d1671756f948dab40792285885f0298e561ee1b diff --cc builtin/rebase--helper.c index ad074705bb,cea99cb323..5d1f12de57 --- a/builtin/rebase--helper.c +++ b/builtin/rebase--helper.c @@@ -22,8 -22,9 +22,11 @@@ int cmd_rebase__helper(int argc, const struct option options[] = { OPT_BOOL(0, "ff", &opts.allow_ff, N_("allow fast-forward")), OPT_BOOL(0, "keep-empty", &keep_empty, N_("keep empty commits")), + OPT_BOOL(0, "allow-empty-message", &opts.allow_empty_message, + N_("allow commits with empty messages")), + OPT_BOOL(0, "recreate-merges", &recreate_merges, N_("recreate merge commits")), + OPT_BOOL(0, "rebase-cousins", &rebase_cousins, + N_("keep original branch points of cousins")), OPT_CMDMODE(0, "continue", &command, N_("continue rebase"), CONTINUE), OPT_CMDMODE(0, "abort", &command, N_("abort rebase"), diff --cc git-rebase.sh index a1f6e5de6a,58d778a2da..b24e4d5d87 --- a/git-rebase.sh +++ b/git-rebase.sh @@@ -266,9 -265,19 +269,22 @@@ d --keep-empty) keep_empty=yes ;; + --allow-empty-message) + allow_empty_message=--allow-empty-message + ;; + --recreate-merges) + recreate_merges=t + test -z "$interactive_rebase" && interactive_rebase=implied + ;; + --recreate-merges=*) + recreate_merges=t + case "${1#*=}" in + rebase-cousins) rebase_cousins=t;; + no-rebase-cousins) rebase_cousins=;; + *) die "Unknown mode: $1";; + esac + test -z "$interactive_rebase" && interactive_rebase=implied + ;; --preserve-merges) preserve_merges=t test -z "$interactive_rebase" && interactive_rebase=implied diff --cc sequencer.c index f9d1001dee,d8cc63dbe4..d34ffd392c --- a/sequencer.c +++ b/sequencer.c @@@ -21,8 -21,10 +21,12 @@@ #include "log-tree.h" #include "wt-status.h" #include "hashmap.h" +#include "notes-utils.h" +#include "sigchain.h" + #include "unpack-trees.h" + #include "worktree.h" + #include "oidmap.h" + #include "oidset.h" #define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION" @@@ -345,15 -322,19 +371,17 @@@ static int write_message(const void *bu if (msg_fd < 0) return error_errno(_("could not lock '%s'"), filename); if (write_in_full(msg_fd, buf, len) < 0) { + error_errno(_("could not write to '%s'"), filename); rollback_lock_file(&msg_file); - return error_errno(_("could not write to '%s'"), filename); + return -1; } if (append_eol && write(msg_fd, "\n", 1) < 0) { + error_errno(_("could not write eol to '%s'"), filename); rollback_lock_file(&msg_file); - return error_errno(_("could not write eol to '%s'"), filename); + return -1; } - if (commit_lock_file(&msg_file) < 0) { - rollback_lock_file(&msg_file); - return error(_("failed to finalize '%s'."), filename); - } + if (commit_lock_file(&msg_file) < 0) + return error(_("failed to finalize '%s'"), filename); return 0; } @@@ -2119,12 -1644,14 +2171,12 @@@ static int save_head(const char *head written = write_in_full(fd, buf.buf, buf.len); strbuf_release(&buf); if (written < 0) { + error_errno(_("could not write to '%s'"), git_path_head_file()); rollback_lock_file(&head_lock); - return error_errno(_("could not write to '%s'"), - git_path_head_file()); + return -1; } - if (commit_lock_file(&head_lock) < 0) { - rollback_lock_file(&head_lock); - return error(_("failed to finalize '%s'."), git_path_head_file()); - } + if (commit_lock_file(&head_lock) < 0) + return error(_("failed to finalize '%s'"), git_path_head_file()); return 0; }