5 git quiltimport [options]
8 author= author name and email address for patches without any
9 patches= path to the quilt series and patches
41 if [ -n "$quilt_author" ] ; then
42 quilt_author_name=$(expr "z$quilt_author" : 'z\(.*[^ ]\) *<.*') &&
43 quilt_author_email=$(expr "z$quilt_author" : '.*<\([^>]*\)') &&
44 test '' != "$quilt_author_name" &&
45 test '' != "$quilt_author_email" ||
46 die "malformed --author parameter"
49 # Quilt patch directory
50 : ${QUILT_PATCHES:=patches}
51 if ! [ -d "$QUILT_PATCHES" ] ; then
52 echo "The \"$QUILT_PATCHES\" directory does not exist."
56 # Temporary directories
57 tmp_dir="$GIT_DIR"/rebase-apply
58 tmp_msg="$tmp_dir/msg"
59 tmp_patch="$tmp_dir/patch"
60 tmp_info="$tmp_dir/info"
63 # Find the initial commit
64 commit=$(git rev-parse HEAD)
66 mkdir $tmp_dir || exit 2
67 while read patch_name level garbage <&3
69 case "$patch_name" in ''|'#'*) continue;; esac
75 echo "unable to parse patch level, ignoring it."
81 echo "trailing garbage found in series file: $garbage"
84 if ! [ -f "$QUILT_PATCHES/$patch_name" ] ; then
85 echo "$patch_name doesn't exist. Skipping."
89 git mailinfo "$tmp_msg" "$tmp_patch" \
90 <"$QUILT_PATCHES/$patch_name" >"$tmp_info" || exit 3
91 test -s "$tmp_patch" || {
92 echo "Patch is empty. Was it split wrong?"
96 # Parse the author information
97 GIT_AUTHOR_NAME=$(sed -ne 's/Author: //p' "$tmp_info")
98 GIT_AUTHOR_EMAIL=$(sed -ne 's/Email: //p' "$tmp_info")
99 export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
100 while test -z "$GIT_AUTHOR_EMAIL" && test -z "$GIT_AUTHOR_NAME" ; do
101 if [ -n "$quilt_author" ] ; then
102 GIT_AUTHOR_NAME="$quilt_author_name";
103 GIT_AUTHOR_EMAIL="$quilt_author_email";
104 elif [ -n "$dry_run" ]; then
105 echo "No author found in $patch_name" >&2;
106 GIT_AUTHOR_NAME="dry-run-not-found";
107 GIT_AUTHOR_EMAIL="dry-run-not-found";
109 echo "No author found in $patch_name" >&2;
117 patch_author_name=$(expr "z$patch_author" : 'z\(.*[^ ]\) *<.*') &&
118 patch_author_email=$(expr "z$patch_author" : '.*<\([^>]*\)') &&
119 test '' != "$patch_author_name" &&
120 test '' != "$patch_author_email" &&
121 GIT_AUTHOR_NAME="$patch_author_name" &&
122 GIT_AUTHOR_EMAIL="$patch_author_email"
125 GIT_AUTHOR_DATE=$(sed -ne 's/Date: //p' "$tmp_info")
126 SUBJECT=$(sed -ne 's/Subject: //p' "$tmp_info")
127 export GIT_AUTHOR_DATE SUBJECT
128 if [ -z "$SUBJECT" ] ; then
129 SUBJECT=$(echo $patch_name | sed -e 's/.patch$//')
132 if [ -z "$dry_run" ] ; then
133 git apply --index -C1 ${level:+"$level"} "$tmp_patch" &&
134 tree=$(git write-tree) &&
135 commit=$( (echo "$SUBJECT"; echo; cat "$tmp_msg") | git commit-tree $tree -p $commit) &&
136 git update-ref -m "quiltimport: $patch_name" HEAD $commit || exit 4
138 done 3<"$QUILT_PATCHES/series"
139 rm -rf $tmp_dir || exit 5