|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "New hack for topgit: git-merge--no-edit" |
| 4 | +--- |
| 5 | + |
| 6 | +Git 1.7.10 对 ``git merge`` 提供了一个改进,而这个改进可能会带来兼容性问题, |
| 7 | +会导致某些依赖 ``git merge`` 自动完成的工具受到影响。而 Topgit 就中招了。 |
| 8 | + |
| 9 | +Junio 的 [一篇博客][blogspot] 专门对这个问题做了描述。简单的说就是Git 1.7.10 起, |
| 10 | +执行 ``git merge`` 时,成功的合并不会使用默认的(没有意义的)提交说明自动提交, |
| 11 | +而是会打开一个编辑器等待用户输入提交说明。 |
| 12 | + |
| 13 | + |
| 14 | +这个改动会使得调用 ``git merge`` 的工具在执行时被打断。Topgit 的 ``tg update`` |
| 15 | +等命令即受此影响。 |
| 16 | + |
| 17 | +这个 [GitHub上的提交][commit] 即用于解决此问题: |
| 18 | + |
| 19 | + From: Jiang Xin <[email protected]> |
| 20 | + Subject: [PATCH] No stop to edit for the new merge behavior of git |
| 21 | + |
| 22 | + In Git 1.7.10, Merge will stop and wait for a merge commit log. This |
| 23 | + backward-incompatible improvement that will break topgit. To fix it, |
| 24 | + just export GIT_MERGE_AUTOEDIT=no. |
| 25 | + |
| 26 | + See: http://git-blame.blogspot.jp/2012/02/anticipating-git-1710.html |
| 27 | + |
| 28 | + Signed-off-by: Jiang Xin <[email protected]> |
| 29 | + |
| 30 | + --- |
| 31 | + tg.sh | 2 ++ |
| 32 | + 1 个文件被修改,插入 2 行(+) |
| 33 | + |
| 34 | + diff --git a/tg.sh b/tg.sh |
| 35 | + index 9082d88..b7661c2 100644 |
| 36 | + --- a/tg.sh |
| 37 | + +++ b/tg.sh |
| 38 | + @@ -430,6 +430,8 @@ get_temp() |
| 39 | + ## Initial setup |
| 40 | + |
| 41 | + set -e |
| 42 | + +# suppress the merge log editor feature since git 1.7.10 |
| 43 | + +export GIT_MERGE_AUTOEDIT=no |
| 44 | + git_dir="$(git rev-parse --git-dir)" |
| 45 | + root_dir="$(git rev-parse --show-cdup)"; root_dir="${root_dir:-.}" |
| 46 | + # Make sure root_dir doesn't end with a trailing slash. |
| 47 | + -- |
| 48 | + tg: (d279e29..) t/git-merge-no-edit (depends on: tgmaster) |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + [blogspot]: http://git-blame.blogspot.jp/2012/02/anticipating-git-1710.html |
| 53 | + [commit]: https://github.com/ossxp-com/topgit/commit/0c0fa52bf82f4ad22a4927b9ab5c400595ad9602 |
0 commit comments