mirror of
https://github.com/jayphelps/git-blame-someone-else.git
synced 2025-05-02 11:35:56 +02:00
Merge 96cf41b9a0
into 07b4f92f3c
This commit is contained in:
commit
a4705216d5
2 changed files with 11 additions and 0 deletions
|
@ -14,6 +14,8 @@ $ sudo make install
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ git blame-someone-else <author> <commit>
|
$ git blame-someone-else <author> <commit>
|
||||||
|
OR
|
||||||
|
$ git blame-someone-else "random" <commit>
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
|
@ -6,6 +6,15 @@ if [ $# -ne 2 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AUTHOR=$1
|
AUTHOR=$1
|
||||||
|
|
||||||
|
if [ "$1" = "random" ]; then
|
||||||
|
CONTRIBUTORS_RAW=$(git shortlog -s)
|
||||||
|
CONTRIBUTORS=($CONTRIBUTORS_RAW)
|
||||||
|
NUM_OF_CONTRIBUTORS=${#CONTRIBUTORS[*]}
|
||||||
|
RAND_NUM=$(( ( RANDOM % (${#CONTRIBUTORS[*]} / 3) ) * 3 + 1 ))
|
||||||
|
AUTHOR="${CONTRIBUTORS[$RAND_NUM]} ${CONTRIBUTORS[$RAND_NUM + 1]}"
|
||||||
|
fi
|
||||||
|
|
||||||
AUTHOR_NAME=$(echo $AUTHOR | perl -wlne '/^(.*)\s*<.*>$/ and print $1')
|
AUTHOR_NAME=$(echo $AUTHOR | perl -wlne '/^(.*)\s*<.*>$/ and print $1')
|
||||||
AUTHOR_EMAIL=$(echo $AUTHOR | perl -wlne '/^.*\s*<(.*)>$/ and print $1')
|
AUTHOR_EMAIL=$(echo $AUTHOR | perl -wlne '/^.*\s*<(.*)>$/ and print $1')
|
||||||
COMMIT=$(git rev-parse --short $2)
|
COMMIT=$(git rev-parse --short $2)
|
||||||
|
|
Loading…
Add table
Reference in a new issue