From: Junio C Hamano Date: Mon, 3 Aug 2015 18:01:16 +0000 (-0700) Subject: Merge branch 'mr/rebase-i-customize-insn-sheet' X-Git-Tag: v2.6.0-rc0~108 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/9f56db7cafc6a4634b8f2fa70f1c8949f4242df1?hp=-c Merge branch 'mr/rebase-i-customize-insn-sheet' "git rebase -i"'s list of todo is made configurable. * mr/rebase-i-customize-insn-sheet: git-rebase--interactive.sh: add config option for custom instruction format --- 9f56db7cafc6a4634b8f2fa70f1c8949f4242df1 diff --combined Documentation/config.txt index 43bb53c047,ad40cac508..75c372238d --- a/Documentation/config.txt +++ b/Documentation/config.txt @@@ -914,8 -914,7 +914,8 @@@ command line with the `--color[=] color.diff.:: Use customized color for diff colorization. `` specifies which part of the patch to use the specified color, and is one - of `plain` (context text), `meta` (metainformation), `frag` + of `context` (context text - `plain` is a historical synonym), + `meta` (metainformation), `frag` (hunk header), 'func' (function in hunk header), `old` (removed lines), `new` (added lines), `commit` (commit headers), or `whitespace` (highlighting whitespace errors). @@@ -2161,6 -2160,11 +2161,11 @@@ rebase.autoStash: successful rebase might result in non-trivial conflicts. Defaults to false. + rebase.instructionFormat + A format string, as specified in linkgit:git-log[1], to be used for + the instruction list during an interactive rebase. The format will automatically + have the long commit hash prepended to the format. + receive.advertiseAtomic:: By default, git-receive-pack will advertise the atomic push capability to its clients. If you don't want to this capability diff --combined git-rebase--interactive.sh index 5ff0f1c81a,b2da100ac5..2f6ce55b58 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@@ -740,10 -740,15 +740,15 @@@ collapse_todo_ids() # "pick sha1 fixup!/squash! msg" appears in it so that the latter # comes immediately after the former, and change "pick" to # "fixup"/"squash". + # + # Note that if the config has specified a custom instruction format + # each log message will be re-retrieved in order to normalize the + # autosquash arrangement rearrange_squash () { # extract fixup!/squash! lines and resolve any referenced sha1's while read -r pick sha1 message do + test -z "${format}" || message=$(git log -n 1 --format="%s" ${sha1}) case "$message" in "squash! "*|"fixup! "*) action="${message%%!*}" @@@ -785,6 -790,7 +790,7 @@@ *" $sha1 "*) continue ;; esac printf '%s\n' "$pick $sha1 $message" + test -z "${format}" || message=$(git log -n 1 --format="%s" ${sha1}) used="$used$sha1 " while read -r squash action msg_prefix msg_content do @@@ -802,8 -808,13 +808,13 @@@ case "$message" in "$msg_content"*) emit=1;; esac ;; esac if test $emit = 1; then - real_prefix=$(echo "$msg_prefix" | sed "s/,/! /g") - printf '%s\n' "$action $squash ${real_prefix}$msg_content" + if test -n "${format}" + then + msg_content=$(git log -n 1 --format="${format}" ${squash}) + else + msg_content="$(echo "$msg_prefix" | sed "s/,/! /g")$msg_content" + fi + printf '%s\n' "$action $squash $msg_content" used="$used$squash " fi done <"$1.sq" @@@ -849,11 -860,7 +860,11 @@@ continue # do we have anything to commit? if git diff-index --cached --quiet HEAD -- then - : Nothing to commit -- skip this + # Nothing to commit -- skip this commit + + test ! -f "$GIT_DIR"/CHERRY_PICK_HEAD || + rm "$GIT_DIR"/CHERRY_PICK_HEAD || + die "Could not remove CHERRY_PICK_HEAD" else if ! test -f "$author_script" then @@@ -981,7 -988,10 +992,10 @@@ els revisions=$onto...$orig_head shortrevisions=$shorthead fi - git rev-list $merges_option --pretty=oneline --reverse --left-right --topo-order \ + format=$(git config --get rebase.instructionFormat) + # the 'rev-list .. | sed' requires %m to parse; the instruction requires %H to parse + git rev-list $merges_option --format="%m%H ${format:-%s}" \ + --reverse --left-right --topo-order \ $revisions ${restrict_revision+^$restrict_revision} | \ sed -n "s/^>//p" | while read -r sha1 rest