Merge branch 'mr/rebase-i-customize-insn-sheet'
authorJunio C Hamano <gitster@pobox.com>
Mon, 3 Aug 2015 18:01:16 +0000 (11:01 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Aug 2015 18:01:16 +0000 (11:01 -0700)
"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

1  2 
Documentation/config.txt
git-rebase--interactive.sh
diff --combined Documentation/config.txt
index 43bb53c0477276d81af484cdb64855698b6a635b,ad40cac50849f5f0e5ef62719586c7c11596403d..75c372238dc66b071af103ac56629953a8e85b12
@@@ -914,8 -914,7 +914,8 @@@ command line with the `--color[=<when>]
  color.diff.<slot>::
        Use customized color for diff colorization.  `<slot>` 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
index 5ff0f1c81ac8e72ce6a2358ca2fced0650571030,b2da100ac5ebf133b8ffbdfaf3c35bf6a7764692..2f6ce55b586d7e71cd954409c30e6574dfcf301e
@@@ -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%%!*}"
                *" $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
                                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