make it possible to update via git extras

This commit is contained in:
luozexuan 2015-08-16 11:47:16 +08:00
parent 11fd45791b
commit 5fb7f6b77c
3 changed files with 40 additions and 6 deletions

View file

@ -34,13 +34,18 @@ and the basic [msys2][1].
Second, clone the `git-extras` repo into any folder you like.
```bash
git clone https://github.com/tj/git-extras.git
# checkout the latest tag (optional)
git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
```
After that, open the script `install.cmd` in the folder with any text editor you like.
Modify the `PREFIX` variable to where your `Git for Windows 2.x` is installed.
After that, execute the `install.cmd` in the command prompt, with the path your `Git for Windows 2.x` is installed.
For example, I install it in the folder called `C:\SCM\PortableGit` and
the `PREFIX` should be `C:\SCM\PortableGit\mingw64` (for 64-bit release)
or `C:\SCM\PortableGit\mingw32` (for 32-bit release).
Third, execute the `install.cmd` directly or in the command prompt.
or `C:\SCM\PortableGit\mingw32` (for 32-bit release). So I will execute the `install.cmd` like this:
```batch
install.cmd "C:\SCM\PortableGit\mingw64"
```
Last, please copy `colrm.exe` and `column.exe` from `folder-your-msys2-installed/usr/bin` to
`folder-your-git-installed/usr/bin`.
Enjoy `git-extras`!

View file

@ -13,12 +13,40 @@ update() {
&& echo "... updated git-extras $VERSION -> $(git extras --version)"
}
updateForWindows() {
local bin=$(which git-extras)
local prefix=${bin%/*/*}
local orig=$PWD
# we need to clean up /tmp manually on windows
cd /tmp \
&& rm -rf ./git-extras \
&& echo "Setting up 'git-exras'...." \
&& git clone https://github.com/tj/git-extras.git &> /dev/null \
&& cd git-extras \
&& git checkout \
$(git describe --tags $(git rev-list --tags --max-count=1)) \
&> /dev/null \
&& ./install.cmd "$prefix" \
&& cd "$orig" \
&& echo "... updated git-extras $VERSION -> $(git extras --version)"
rm -rf /tmp/git-extras &> /dev/null
}
case "$1" in
-v|--version)
echo $VERSION && exit 0
;;
update)
update
platform=$(uname -s)
if [ $(expr substr "$platform" 1 9) = "CYGWIN_NT" ] || \
[ $(expr substr "$platform" 1 10) = "MINGW32_NT" ] || \
[ $(expr substr "$platform" 1 10) = "MINGW64_NT" ]
then
updateForWindows
else
update
fi
;;
*)
git extras --help

View file

@ -1,5 +1,6 @@
@ECHO OFF
SET PREFIX=C:\SCM\PortableGit\mingw64
IF NOT "%~1"=="" SET PREFIX="%~1"
SET HTMLDIR=%PREFIX%\share\doc\git-doc
SET GITEXTRAS=%~dp0
@ -22,6 +23,6 @@ FOR %%i in (%COMMANDS_WITHOUT_REPO%) DO (
MORE +2 %GITEXTRAS%\bin\%%i >> %PREFIX%\bin\%%i
)
ROBOCOPY %GITEXTRAS%\man %HTMLDIR% *.html
ROBOCOPY /IS %GITEXTRAS%\man %HTMLDIR% *.html
@ECHO ON