summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/guilt/files/improve_auto_header_gen.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/guilt/files/improve_auto_header_gen.patch')
-rw-r--r--meta/recipes-devtools/guilt/files/improve_auto_header_gen.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/meta/recipes-devtools/guilt/files/improve_auto_header_gen.patch b/meta/recipes-devtools/guilt/files/improve_auto_header_gen.patch
new file mode 100644
index 0000000000..b98ec5e9fe
--- /dev/null
+++ b/meta/recipes-devtools/guilt/files/improve_auto_header_gen.patch
@@ -0,0 +1,69 @@
1guilt: improve the generation of an automatic header
2
3Patches that do not have a proper header are encountered when generating
4a tree. This improves the detection of these patches and generates a sane
5header so the eventual commit will be coherent
6
7Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
8
9---
10
11 guilt | 24 ++++++++++++++++++------
12 1 file changed, 18 insertions(+), 6 deletions(-)
13
14--- a/guilt
15+++ b/guilt
16@@ -591,7 +591,12 @@ commit()
17 fi
18
19 # last try: make a default commit message if patch doesn't contain one
20- [ ! -s "$TMP_MSG" ] && echo "auto_msg: patch $pname" > "$TMP_MSG"
21+ if [ ! -s "$TMP_MSG" ]; then
22+ echo "auto_msg: importing `basename $pname`" > "$TMP_MSG"
23+ echo "" >> "$TMP_MSG"
24+ echo "This is an automatic import of patch $pname, no headers were" >> "$TMP_MSG"
25+ echo "detected and a default message was constructed" >> "$TMP_MSG"
26+ fi
27
28
29 if [ "$header_type" = "guilt" ]; then
30@@ -599,12 +604,14 @@ commit()
31 # extract a From line from the patch header, and set
32 # GIT_AUTHOR_{NAME,EMAIL}
33 author_str=`sed -n -e '/^From:/ { s/^From: //; p; q }; /^(diff |---)/ q' "$p"`
34- if [ ! -z "$author_str" ]; then
35- GIT_AUTHOR_NAME=`echo $author_str | sed -e 's/ *<.*$//'`
36- export GIT_AUTHOR_NAME="${GIT_AUTHOR_NAME:-" "}"
37- export GIT_AUTHOR_EMAIL="`echo $author_str | sed -e 's/[^<]*//'`"
38+ if [ -z "$author_str" ]; then
39+ author_str="auto commit <unknown@unknown>"
40 fi
41
42+ GIT_AUTHOR_NAME=`echo $author_str | sed -e 's/ *<.*$//'`
43+ export GIT_AUTHOR_NAME="${GIT_AUTHOR_NAME:-" "}"
44+ export GIT_AUTHOR_EMAIL="`echo $author_str | sed -e 's/[^<]*//'`"
45+
46
47 # check in the patch for a subject
48 SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$p")"
49@@ -615,6 +622,11 @@ commit()
50 if [ ${#SUBJECT} -gt 60 ]; then
51 SUBJECT=${SUBJECT: -60}
52 fi
53+
54+ # remove the line from the tmp msg
55+ mv "$TMP_MSG" "$TMP_MSG.work"
56+ cat "$TMP_MSG.work" | grep -v -E ".*$SUBJECT.*" > "$TMP_MSG"
57+ rm "$TMP_MSG.work"
58 fi
59
60 if [ -z "$SUBJECT" ]; then
61@@ -629,7 +641,7 @@ commit()
62
63 SUBJECT=`echo $SUBJECT | sed s'%^ *%%'`
64
65- if [ ! -z "$SUBJECT" ]; then
66+ if [ -n "$SUBJECT" ]; then
67 echo "$SUBJECT" >> $TMP_MSG.subject
68 echo "" >> $TMP_MSG.subject
69 cat "$TMP_MSG" >> $TMP_MSG.subject