Skip to content

Commit 7ca7ac6

Browse files
committed
Make script better
1 parent 2ad2727 commit 7ca7ac6

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed
Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,45 @@
11
#!/bin/bash
22

3-
if [ ! $# == 1 ]; then
4-
echo "Usage: $0 author_name"
3+
if [ ! $# == 2 ]; then
4+
echo "Usage: $0 author_name output_root_directory"
55
exit 1
66
fi
77

88
author=$1
9+
output=$2
910
end=""
1011
begin=""
12+
patchcount=1
13+
rangecount=1
1114

1215
for O in $(git log --pretty=format:"%h" --author="$author"); do
1316
if ! git log --pretty=format:"%h" --author="$author" $O^^..$O^ --exit-code 1>/dev/null ; then
1417
if [[ "$end" == "" ]]; then
1518
end=$O
1619
fi
1720
begin=$O
21+
((rangecount++))
1822
else
1923
if [[ "$end" == "" ]]; then
20-
git format-patch $O^..$O
24+
tmp=$(($patchcount - 1))
25+
echo "Adding one patch to $tmp existing:"
26+
git log $O^..$O
27+
echo "Please enter a subdirectory name for this patch:"
28+
read subdir
29+
mkdir -p $output/$subdir
30+
git format-patch $O^..$O -o$output/$subdir
31+
((patchcount++))
2132
else
22-
git format-patch $begin^^..$end
33+
tmp=$(($patchcount - 1))
34+
echo "Adding $rangecount patches to $tmp existing."
35+
git log $begin^^..$end --oneline
36+
echo "Please enter a subdirectory name for this patch:"
37+
read subdir
38+
mkdir -p $output/$subdir
39+
git format-patch $begin^^..$end -o$output/$subdir
2340
end=""
41+
patchcount=$(($patchcount + $rangecount))
42+
rangecount=1
2443
fi
2544
fi
2645
done

0 commit comments

Comments
 (0)