差分をzipで圧縮して出力したいと思います。
※環境はWindowsです。
下記をSourceTreeのターミナルで実行すると要望通りのものが生成されますが、
git archive --format=zip HEAD `git diff --name-only HEAD HEAD^` -o archive.zip
いつも入力するのが手間です。
カスタムアクションに登録するにはどのようにすればよいでしょうか?
git archive --format=zip HEAD `git diff --name-only HEAD HEAD^` -o archive.zip
↑って、バッククォートがあるので、すんなりとはバッチファイルにできないですよね。
試してないですけど、こんな感じのバッチファイルになるんじゃないかと思います。
for /f "delims=" %%A in ('git diff --name-only HEAD "HEAD^"') do set DIFF_LIST=%%A git archive --format=zip HEAD %DIFF_LIST% -o archive.zip
後、git コマンドは SourceTree に付いてくるものを使ってるでしょうか。
Atlassian の Q&A サイトで こんなやりとりがあったのを見つけましたので、こちらもご参考に。
I've tried putting "git" in the "script target", which errors with no explanation. I've tried putting "cmd" in the script target with "/C git" in the "Parameters" and gotten a "'git' is not recognized" error.
You can add git to your path or specify the path to git.exe in your .bat file.
You should be able to find git.exe here:%USERPROFILE%\AppData\Local\Atlassian\SourceTree\git_local\binHow to run a git command as a custom action? - Atlassian Answers
見させていただきます!
git archive --format=zip HEAD `git diff --name-only HEAD HEAD^` -o archive.zip
↑って、バッククォートがあるので、すんなりとはバッチファイルにできないですよね。
試してないですけど、こんな感じのバッチファイルになるんじゃないかと思います。
for /f "delims=" %%A in ('git diff --name-only HEAD "HEAD^"') do set DIFF_LIST=%%A git archive --format=zip HEAD %DIFF_LIST% -o archive.zip
後、git コマンドは SourceTree に付いてくるものを使ってるでしょうか。
Atlassian の Q&A サイトで こんなやりとりがあったのを見つけましたので、こちらもご参考に。
I've tried putting "git" in the "script target", which errors with no explanation. I've tried putting "cmd" in the script target with "/C git" in the "Parameters" and gotten a "'git' is not recognized" error.
You can add git to your path or specify the path to git.exe in your .bat file.
You should be able to find git.exe here:%USERPROFILE%\AppData\Local\Atlassian\SourceTree\git_local\binHow to run a git command as a custom action? - Atlassian Answers
単語帳登録とは発送の転換に驚きました。頭固いですね。自分。
他の点も試させて頂きます。
for /f "delims=" %%A in ('git diff --name-only HEAD "HEAD^"') do set DIFF_LIST=%%A
git archive --format=zip HEAD %DIFF_LIST% -o archive.zip
で十分でした!
ありがとうございます。
単語帳登録とは発送の転換に驚きました。頭固いですね。自分。
2014/05/27 18:25:52他の点も試させて頂きます。
for /f "delims=" %%A in ('git diff --name-only HEAD "HEAD^"') do set DIFF_LIST=%%A
2014/05/27 18:28:04git archive --format=zip HEAD %DIFF_LIST% -o archive.zip
で十分でした!
ありがとうございます。