Skip to content

Commit c24529f

Browse files
committed
Add documentation and code-review relative diff
1 parent 38f1396 commit c24529f

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,30 @@
22

33
zsh code review plugin
44

5+
### Usage
6+
7+
```
8+
code-review [base_branch] [target_branch]
9+
```
10+
11+
- `base_branch`: (default: $REVIEW_BASE_BRANCH, master)
12+
- `target_branch`: (default: HEAD)
13+
14+
Launches `git difftool` on `git merge-base target_branch base_branch` and
15+
`target_branch`.
16+
517
### Install
618

7-
If using `antibody`: `antibody bundle xorkevin/code-review-zsh`
19+
#### Antibody
20+
21+
```
22+
$ antibody bundle xorkevin/code-review-zsh
23+
```
24+
25+
#### Manual
26+
27+
In `.zshrc`:
28+
29+
```
30+
source code-review.plugin.zsh
31+
```

code-review.plugin.zsh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ function code-review () {
55
return
66
fi
77

8-
local base_branch=${1:-${GIT_BASE_BRANCH:-master}}
8+
local base_branch=${1:-${REVIEW_BASE_BRANCH:-master}}
99
local target_branch=${2:-HEAD}
1010

1111
local merge_base=$(git merge-base $target_branch $base_branch)
1212

1313
local shortstatout=$(git diff --shortstat --color $merge_base $target_branch)
1414
local statout=$(git diff --stat --color $merge_base $target_branch)
15-
local filesout=$(git diff --name-only $merge_base $target_branch)
15+
local filesout=$(git diff --relative --name-only $merge_base $target_branch)
1616

1717
local LESS
1818
local selectfile
@@ -26,6 +26,7 @@ function code-review () {
2626
# clear screen; move to top left
2727
echo -ne "\e[2J\e[H"
2828
echo " comparing $base_branch..$target_branch"
29+
echo " from $(pwd)"
2930
echo $shortstatout
3031
echo -n " Usage: l - list changed files, f - launch difftool for file, q - quit"
3132
read -sk opt

0 commit comments

Comments
 (0)