-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path_cj-git-patchtool-start
More file actions
executable file
·73 lines (56 loc) · 1.35 KB
/
_cj-git-patchtool-start
File metadata and controls
executable file
·73 lines (56 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
usage () {
echo "$0 base-id basedir [ end-id ]"
echo " creates directory basedir, puts patches and _list there,"
echo " checks them into a repo, and opens _list and a terminal"
echo " within basedir."
echo " end-id is HEAD by default."
exit 1
}
if [ $# -ne 2 -a $# -ne 3 ]; then
usage
fi
if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage
fi
set -eu
_baseid="$1"
basedir="$2"
_endid="${3-HEAD}"
baseid="$(git rev-parse "$_baseid")"
endid="$(git rev-parse "$_endid")"
if [ -e "$basedir" ]; then
echo "'$basedir' already exists"
exit 1
fi
basebasedir=`dirname "$basedir"`
if [ '!' -d "$basebasedir" ]; then
echo "directory '$basebasedir' does not exist"
exit 1
fi
if ! cj-git-status-is-clean; then
exit 1
fi
tmpdir="tmp-`passwdgen`"
mkdir "$tmpdir"
cd "$tmpdir"
git format-patch --no-signature --thread -M -C "$baseid".."$endid"
ls *.patch > _list
echo "$baseid" > _baseid
echo "$baseid" > _origbaseid
echo "$endid" > _origheadid
cd ..
mv "$tmpdir" "$basedir"
if [ "$baseid" = "`git rev-parse HEAD`" ]; then
echo "***NOTE***: not adding tag because baseid is HEAD"
else
gdrop -a -m "for basedir '$basedir', baseid '$baseid', endid '$endid'
(_baseid '$_baseid', _endid '$_endid')" patchtool
fi
cd "$basedir"
cj-git-init
git add .
git commit -m "orig"
term
"$EDITOR" _list &
#or without quotes?^