Implement a --dry-run option to git-quiltimport
Since large quilt trees like -mm can easily have patches without clear authorship information, add a --dry-run option to make the problem patches easy to find. Signed-off-by: Junio C Hamano <junkio@cox.net>
Eric W. Biederman committed
May 17, 2006 at 14:10 UTC
d3bd4ee1a5cc771b86f73dd0f4a2bea6f652b20a
2 files changed
+25
-7
Documentation/git-quiltimport.txt
+7
-1
@@ -9,7 +9,7 @@ git-quiltimport - Applies a quilt patchset onto the current branch
9
SYNOPSIS
10
--------
11
[verse]
12
-'git-quiltimport' [--author <author>] [--patches <dir>]
12
+'git-quiltimport' [--dry-run] [--author <author>] [--patches <dir>]
13
14
15
DESCRIPTION
@@ -29,6 +29,12 @@ preserved as the 1 line subject in the git description.
29
30
OPTIONS
31
-------
32
+--dry-run::
33
+ Walk through the patches in the series and warn
34
+ if we cannot find all of the necessary information to commit
35
+ a patch. At the time of this writing only missing author
36
+ information is warned about.
37
+
38
--author Author Name <Author Email>::
39
The author name and email address to use when no author
40
information can be found in the patch description.
git-quiltimport.sh
+18
-6
@@ -1,8 +1,9 @@
1
#!/bin/sh
2
-USAGE='--author <author> --patches </path/to/quilt/patch/directory>'
2
+USAGE='--dry-run --author <author> --patches </path/to/quilt/patch/directory>'
3
SUBDIRECTORY_ON=Yes
4
. git-sh-setup
5
6
+dry_run=""
7
quilt_author=""
8
while case "$#" in 0) break;; esac
9
do
@@ -19,6 +20,11 @@ do
20
shift
21
;;
22
23
+ --dry-run)
24
+ shift
25
+ dry_run=1
26
+ ;;
27
+
28
--pa=*|--pat=*|--patc=*|--patch=*|--patche=*|--patches=*)
29
QUILT_PATCHES=$(expr "$1" : '-[^=]*\(.*\)')
30
shift
@@ -75,8 +81,12 @@ for patch_name in $(cat "$QUILT_PATCHES/series" | grep -v '^#'); do
81
if [ -n "$quilt_author" ] ; then
82
GIT_AUTHOR_NAME="$quilt_author_name";
83
GIT_AUTHOR_EMAIL="$quilt_author_email";
84
+ elif [ -n "$dry_run" ]; then
85
+ echo "No author found in $patch_name" >&2;
86
+ GIT_AUTHOR_NAME="dry-run-not-found";
87
+ GIT_AUTHOR_EMAIL="dry-run-not-found";
88
else
79
- echo "No author found in $patch_name";
89
+ echo "No author found in $patch_name" >&2;
90
echo "---"
91
cat $tmp_msg
92
echo -n "Author: ";
@@ -98,9 +108,11 @@ for patch_name in $(cat "$QUILT_PATCHES/series" | grep -v '^#'); do
108
SUBJECT=$(echo $patch_name | sed -e 's/.patch$//')
109
fi
110
101
- git-apply --index -C1 "$tmp_patch" &&
102
- tree=$(git-write-tree) &&
103
- commit=$((echo "$SUBJECT"; echo; cat "$tmp_msg") | git-commit-tree $tree -p $commit) &&
104
- git-update-ref HEAD $commit || exit 4
111
+ if [ -z "$dry_run" ] ; then
112
+ git-apply --index -C1 "$tmp_patch" &&
113
+ tree=$(git-write-tree) &&
114
+ commit=$((echo "$SUBJECT"; echo; cat "$tmp_msg") | git-commit-tree $tree -p $commit) &&
115
+ git-update-ref HEAD $commit || exit 4
116
+ fi
117
done
118
rm -rf $tmp_dir || exit 5