Minor fix for PATH with spaces.
[git-scripts.git] / git-branch-commits
blob58ffb6a7d55eeed926619de1f0285c8bb7714f6c
1 #!/bin/sh
3 # List all commits done on topic branche
5 USAGE='[options|-h] topic [branch_name]'
6 LONG_USAGE='List all commits done on topic branche
7 options to pass to git log
8 branch is optional, default to master
11 if [ "$1" = "" ]; then
12 echo $0 topic_branch
15 topic=$1
17 if [ "$2" = "" ]; then
18 branch=master
19 else
20 branch=$2
23 exec_path=$(git --exec-path)
24 . $exec_path/git-sh-setup
26 options=
28 list_commits () {
29 topic=$1
30 branch=$2
31 git log $options \
32 $(git rev-list --boundary $topic...$branch | grep ^- | cut -c2- \
33 | ( read one; echo $one...$topic ))
36 test "$#" = "0" && usage && exit 1;
38 branch=master
40 while [ "$#" != "0" ]; do
41 case $1 in
42 -h|*help)
43 usage;;
44 -*)
45 options="$options $1"
46 shift;;
48 topic=$1
49 shift
50 test "$1" != "" && branch=$1
51 list_commits $topic $branch
52 exit 0;;
53 esac
54 done