File tree 1 file changed +70
-0
lines changed
1 file changed +70
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ krepo=" $1 "
6
+ urepo=$( git rev-parse --show-toplevel)
7
+ patches=$( mktemp -d)
8
+ commit=" $2 "
9
+
10
+ if [ ! -d " $krepo " ]; then
11
+ echo " expected the kernel directory as \$ 1, but got \" $krepo \" which either doesn't exist or is not a directory"
12
+ exit 1
13
+ fi
14
+
15
+ pushd " $krepo " > /dev/null
16
+
17
+ if ! git cat-file -e " $commit ^{commit}" ; then
18
+ echo " commit $commit does not seem to exist."
19
+ exit 1
20
+ fi
21
+
22
+ echo " Copying all commits in \" $krepo \" into \" $urepo \" from commit $commit onwards:"
23
+ git log --oneline " $commit ..HEAD"
24
+ read -p " Does this look good to you? [Y/n] " ans
25
+ case " $ans " in
26
+ Y)
27
+ ;;
28
+ y)
29
+ ;;
30
+ * )
31
+ exit 1
32
+ ;;
33
+ esac
34
+
35
+ popd > /dev/null # $krepo
36
+
37
+ krepo=$( realpath " $krepo " )
38
+ urepo=$( realpath " $urepo " )
39
+ patches=$( realpath " $patches " )
40
+
41
+ pushd " $krepo " > /dev/null
42
+
43
+ git format-patch --quiet --output-directory " $patches " " $commit "
44
+
45
+ pushd " $patches " > /dev/null
46
+
47
+ sed -i ' s/^\(Subject: \[PATCH .*\] \)rust: pin-init: /\1/' *
48
+
49
+ popd > /dev/null # $patches
50
+
51
+ popd > /dev/null # $krepo
52
+
53
+ pushd " $urepo " > /dev/null
54
+
55
+ head=$( git rev-parse HEAD)
56
+
57
+ git am \
58
+ --signoff \
59
+ --reject \
60
+ --interactive \
61
+ -p3 \
62
+ --empty=drop \
63
+ $patches /*
64
+
65
+ # need the `--exec 'true'` in order for the `--no-keep-empty` option to actually do stuff
66
+ git rebase --no-keep-empty --quiet --exec ' true' " $head "
67
+
68
+ popd > /dev/null # $urepo
69
+
70
+ rm $patches /*
You can’t perform that action at this time.
0 commit comments