5 git quiltimport [options]
8 author= author name and email address for patches without any
9 patches= path to the quilt patches
10 series= path to the quilt series file
46 if [ -n
"$quilt_author" ] ; then
47 quilt_author_name
=$
(expr "z$quilt_author" : 'z\(.*[^ ]\) *<.*') &&
48 quilt_author_email
=$
(expr "z$quilt_author" : '.*<\([^>]*\)') &&
49 test '' != "$quilt_author_name" &&
50 test '' != "$quilt_author_email" ||
51 die
"malformed --author parameter"
54 # Quilt patch directory
55 : ${QUILT_PATCHES:=patches}
56 if ! [ -d
"$QUILT_PATCHES" ] ; then
57 echo "The \"$QUILT_PATCHES\" directory does not exist."
62 : ${QUILT_SERIES:=$QUILT_PATCHES/series}
63 if ! [ -e
"$QUILT_SERIES" ] ; then
64 echo "The \"$QUILT_SERIES\" file does not exist."
68 # Temporary directories
69 tmp_dir
="$GIT_DIR"/rebase
-apply
70 tmp_msg
="$tmp_dir/msg"
71 tmp_patch
="$tmp_dir/patch"
72 tmp_info
="$tmp_dir/info"
75 # Find the initial commit
76 commit
=$
(git
rev-parse HEAD
)
78 mkdir
$tmp_dir ||
exit 2
79 while read patch_name level garbage
<&3
81 case "$patch_name" in ''|
'#'*) continue;; esac
87 echo "unable to parse patch level, ignoring it."
93 echo "trailing garbage found in series file: $garbage"
96 if ! [ -f
"$QUILT_PATCHES/$patch_name" ] ; then
97 echo "$patch_name doesn't exist. Skipping."
101 git mailinfo
"$tmp_msg" "$tmp_patch" \
102 <"$QUILT_PATCHES/$patch_name" >"$tmp_info" ||
exit 3
103 test -s
"$tmp_patch" ||
{
104 echo "Patch is empty. Was it split wrong?"
108 # Parse the author information
109 GIT_AUTHOR_NAME
=$
(sed -ne
's/Author: //p' "$tmp_info")
110 GIT_AUTHOR_EMAIL
=$
(sed -ne
's/Email: //p' "$tmp_info")
111 export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
112 while test -z
"$GIT_AUTHOR_EMAIL" && test -z
"$GIT_AUTHOR_NAME" ; do
113 if [ -n
"$quilt_author" ] ; then
114 GIT_AUTHOR_NAME
="$quilt_author_name";
115 GIT_AUTHOR_EMAIL
="$quilt_author_email";
116 elif [ -n
"$dry_run" ]; then
117 echo "No author found in $patch_name" >&2;
118 GIT_AUTHOR_NAME
="dry-run-not-found";
119 GIT_AUTHOR_EMAIL
="dry-run-not-found";
121 echo "No author found in $patch_name" >&2;
129 patch_author_name
=$
(expr "z$patch_author" : 'z\(.*[^ ]\) *<.*') &&
130 patch_author_email
=$
(expr "z$patch_author" : '.*<\([^>]*\)') &&
131 test '' != "$patch_author_name" &&
132 test '' != "$patch_author_email" &&
133 GIT_AUTHOR_NAME
="$patch_author_name" &&
134 GIT_AUTHOR_EMAIL
="$patch_author_email"
137 GIT_AUTHOR_DATE
=$
(sed -ne
's/Date: //p' "$tmp_info")
138 SUBJECT
=$
(sed -ne
's/Subject: //p' "$tmp_info")
139 export GIT_AUTHOR_DATE SUBJECT
140 if [ -z
"$SUBJECT" ] ; then
141 SUBJECT
=$
(echo $patch_name |
sed -e
's/.patch$//')
144 if [ -z
"$dry_run" ] ; then
145 git apply
--index
-C1
${level:+"$level"} "$tmp_patch" &&
146 tree
=$
(git
write-tree
) &&
147 commit
=$
( (echo "$SUBJECT"; echo; cat "$tmp_msg") | git commit
-tree
$tree -p
$commit) &&
148 git update
-ref
-m
"quiltimport: $patch_name" HEAD
$commit ||
exit 4
150 done 3<"$QUILT_SERIES"
151 rm -rf
$tmp_dir ||
exit 5