Terminal IDEでgit-flowを使う

Terminal IDEgit-flowをインストールしたときのメモ。

Terminal IDEのgitはhttps://のレポジトリをクローンできないので*1ブラウザーなどでgit-flowとshFlagsをダウンロードして、作業ディレクトリに展開する*2

$ unzip /sdcard/Download/gitflow-0.4.1.zip
$ unzip /sdcard/Download/shFlags-1.0.3.zip

Androidのshは/system/bin/shなので、git-flowスクリプトを変更する。

$ nano gitflow-0.4.1/git-flow
diff --git a/git-flow b/git-flow
index fa87e71..361158b 100755
--- a/git-flow
+++ b/git-flow
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/system/bin/sh
 #
 # git-flow -- A collection of Git extensions to provide high-level
 # repository operations for Vincent Driessen's branching model.

gitflow-shFlagsのリンクを張り直す。

$ cd gitflow-0.4.1/
$ rm gitflow-shFlags
$ ln -s ../shFlags-1.0.3/src/shflags gitflow-shFlags

Terminal IDEに入っているgetoptは引数無しの時1を返すので、次のようにgitflow-shFlagsを修正する。

$ nano gitflow-shFlags
diff --git a/src/shflags b/src/shflags
index f69928e..9639cf6 100644
--- a/src/shflags
+++ b/src/shflags
@@ -119,6 +119,7 @@ __FLAGS_GETOPT_VERS_BSD=2
 getopt >/dev/null 2>&1
 case $? in
   0) __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD} ;;  # bsd getopt
+  1) __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_ENH} ;;
   2)
     # TODO(kward): look into '-T' option to test the internal getopt() version
     if [ "`getopt --version`" = '-- ' ]; then

$HOME/local以下にgit-flowをインストールする。

$ make prefix=$HOME/local install

正しくインストールされていることを確認する。

$ type git-flow
git-flow is /data/data/com.spartacusrex.spartacuside/files/local/bin/git-flow

$ git flow help
usage: git flow 

Available subcommands are:
   init      Initialize a new git repo with support for the branching model.
   feature   Manage your feature branches.
   release   Manage your release branches.
   hotfix    Manage your hotfix branches.
   support   Manage your support branches.
   version   Shows version information.

Try 'git flow  help' for details.

*1:AIDE有料オプションAgitでは可能。

*2:ZIPファイルのあるディレクトリはダウンロードに使ったソフトウェアによって異なる。