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
11 keep-non-patch Pass -b to git mailinfo
50 if [ -n "$quilt_author" ] ; then
51 quilt_author_name
=$
(expr "z$quilt_author" : 'z\(.*[^ ]\) *<.*') &&
52 quilt_author_email
=$
(expr "z$quilt_author" : '.*<\([^>]*\)') &&
53 test '' != "$quilt_author_name" &&
54 test '' != "$quilt_author_email" ||
55 die
"malformed --author parameter"
58 # Quilt patch directory
59 : ${QUILT_PATCHES:=patches}
60 if ! [ -d "$QUILT_PATCHES" ] ; then
61 echo "The \"$QUILT_PATCHES\" directory does not exist."
66 : ${QUILT_SERIES:=$QUILT_PATCHES/series}
67 if ! [ -e "$QUILT_SERIES" ] ; then
68 echo "The \"$QUILT_SERIES\" file does not exist."
72 # Temporary directories
73 tmp_dir
="$GIT_DIR"/rebase-apply
74 tmp_msg
="$tmp_dir/msg"
75 tmp_patch
="$tmp_dir/patch"
76 tmp_info
="$tmp_dir/info"
79 # Find the initial commit
80 commit
=$
(git rev-parse HEAD
)
82 mkdir
$tmp_dir ||
exit 2
83 while read patch_name level garbage
<&3
85 case "$patch_name" in ''|
'#'*) continue;; esac
91 echo "unable to parse patch level, ignoring it."
97 echo "trailing garbage found in series file: $garbage"
100 if ! [ -f "$QUILT_PATCHES/$patch_name" ] ; then
101 echo "$patch_name doesn't exist. Skipping."
105 git mailinfo
$MAILINFO_OPT "$tmp_msg" "$tmp_patch" \
106 <"$QUILT_PATCHES/$patch_name" >"$tmp_info" ||
exit 3
107 test -s "$tmp_patch" ||
{
108 echo "Patch is empty. Was it split wrong?"
112 # Parse the author information
113 GIT_AUTHOR_NAME
=$
(sed -ne 's/Author: //p' "$tmp_info")
114 GIT_AUTHOR_EMAIL
=$
(sed -ne 's/Email: //p' "$tmp_info")
115 export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
116 while test -z "$GIT_AUTHOR_EMAIL" && test -z "$GIT_AUTHOR_NAME" ; do
117 if [ -n "$quilt_author" ] ; then
118 GIT_AUTHOR_NAME
="$quilt_author_name";
119 GIT_AUTHOR_EMAIL
="$quilt_author_email";
120 elif [ -n "$dry_run" ]; then
121 echo "No author found in $patch_name" >&2;
122 GIT_AUTHOR_NAME
="dry-run-not-found";
123 GIT_AUTHOR_EMAIL
="dry-run-not-found";
125 echo "No author found in $patch_name" >&2;
133 patch_author_name
=$
(expr "z$patch_author" : 'z\(.*[^ ]\) *<.*') &&
134 patch_author_email
=$
(expr "z$patch_author" : '.*<\([^>]*\)') &&
135 test '' != "$patch_author_name" &&
136 test '' != "$patch_author_email" &&
137 GIT_AUTHOR_NAME
="$patch_author_name" &&
138 GIT_AUTHOR_EMAIL
="$patch_author_email"
141 GIT_AUTHOR_DATE
=$
(sed -ne 's/Date: //p' "$tmp_info")
142 SUBJECT
=$
(sed -ne 's/Subject: //p' "$tmp_info")
143 export GIT_AUTHOR_DATE SUBJECT
144 if [ -z "$SUBJECT" ] ; then
145 SUBJECT
=$
(echo $patch_name |
sed -e 's/.patch$//')
148 if [ -z "$dry_run" ] ; then
149 git apply
--index -C1 ${level:+"$level"} "$tmp_patch" &&
150 tree
=$
(git write-tree
) &&
151 commit
=$
( (echo "$SUBJECT"; echo; cat "$tmp_msg") | git commit-tree
$tree -p $commit) &&
152 git update-ref
-m "quiltimport: $patch_name" HEAD
$commit ||
exit 4
154 done 3<"$QUILT_SERIES"
155 rm -rf $tmp_dir ||
exit 5