dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

git-review (1277B)


      1 #!/usr/bin/env bash
      2 case "$1" in
      3   files)
      4     # list files which have changed since REVIEW_BASE
      5     # (REVIEW_BASE defaults to 'master' in my zshrc)
      6     git diff --name-only $(git merge-base HEAD "${REVIEW_BASE:-master}")
      7     ;;
      8 
      9   stat)
     10     # Same as above, but with a diff stat instead of just names
     11     # (better for interactive use)
     12     git diff --stat $(git merge-base HEAD "${REVIEW_BASE:-master}") | sort -t \| -k 2nr | less -R
     13     ;;
     14 
     15   diff)
     16     # Open all files changed since REVIEW_BASE in Vim tabs
     17     # Then, run fugitive's :Gdiff in each tab, and finally
     18     # tell vim-gitgutter to show +/- for changes since REVIEW_BASE
     19     vim -p $(git review files) +"tabdo Gdiff ${REVIEW_BASE:-master}" +"let g:gitgutter_diff_base = '${REVIEW_BASE:-master}'"
     20     ;;
     21 
     22   edit)
     23     # Open all files changed since REVIEW_BASE in Vim
     24     vim $(git review files)
     25     ;;
     26 
     27   one)
     28     # Same as the above, except specify names of files as arguments,
     29     # instead of opening all files:
     30     # git reviewone foo.js bar.js
     31     vim -p +"tabdo Gdiff ${REVIEW_BASE:-master}" +"let g:gitgutter_diff_base = '${REVIEW_BASE:-master}'" "$@"
     32     ;;
     33 
     34   *)
     35     echo "Commands:"
     36     echo -e "  - files"
     37     echo -e "  - stat"
     38     echo -e "  - diff"
     39     echo -e "  - edit"
     40     echo -e "  - one"
     41 esac