A simple commit review script for vim users

Hi all,

Below is a script that checks out the commit for a given day of HMH and then invokes vim with one tab page for each file modified by a commit, and in each tab page, (1) a git-diff view relative to the parent commit (requires vim-fugitive) and (2) a taglist view (requires vim-taglist).

You will need git and diff somewhere in your %PATH%. (On Windows, the diff under usr\bin in the git installation directory should be fine.)

Translation to something more Unixy should be straightforward; the loop can be replaced by the initialization of an array parameter.

Use it like this:

1
review  181


Here it is:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
:: file:review.bat
@echo off
w:
cd \handmade
git checkout day1%1
setlocal EnableDelayedExpansion
set VV=git diff-tree --no-commit-id --name-only -r HEAD
set out=
for /f "usebackq" %%a in (`%VV%`) do @(
        set out=!out! %%a
        )
git show --stat
pause
gvim -c "set columns=300 | exe 'tabdo Tlist | Gdiff HEAD~ | wincmd = | normal gg]c' | cd code" -p %out%
goto:eof
Oops; change the 'checkout' line to:

1
git checkout day%1