--- oslo-series-final/0006-Fix-and-simplify-the-do_get_patch-function.patch +++ oslo-series-v2/v2-0006-Fix-the-do_get_patch-function.patch @@ -1,20 +1,29 @@ -From a8a55a8fae2326c34557d86d3c2e20a05a6c3f9c Mon Sep 17 00:00:00 2001 +From 58a2ed5a97ce4da3d5e17b3314e358b9491e6f43 Mon Sep 17 00:00:00 2001 From: Per Cederqvist -Date: Wed, 19 Mar 2014 20:24:54 +0100 -Subject: [GUILT 06/28] Fix and simplify the do_get_patch function. +Date: Tue, 13 May 2014 21:03:41 +0200 +Subject: [GUILT v2 06/29] Fix the do_get_patch function. To: Jeff Sipek Cc: git@vger.kernel.org -When extracting the patch, we only want the actual patches. We don't -want the "---" delimiter. Simplify the extraction by simply deleting -everything before the first "diff " line. (Use sed instead of awk to -simplify the code.) +A patch file consists of: -Without this patch, "guilt fold" and "guilt push" sometimes fails if -guilt.diffstat is true. +(1) the description +(2) optional diffstat +(3) the patches + +When extracting the patch, we only want part 3. The do_get_patch used +to give us part 2 and part 3. That made for instance this series of +operations fail if guilt.diffstat is true: + + guilt push empty-1 + guilt push empty-2 + guilt pop + guilt fold empty-2 + guilt pop + guilt push Signed-off-by: Per Cederqvist --- - guilt | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) + guilt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guilt b/guilt index 8701481..c59cd0f 100755 --- a/guilt +++ b/guilt - @@ -332,12 +332,7 @@ do_make_header() - # usage: do_get_patch patchfile - do_get_patch() + @@ -334,7 +334,7 @@ do_get_patch() { - - awk ' - -BEGIN{} + awk ' + BEGIN{} -/^(diff |---$|--- )/ {patch = 1} - -patch == 1 {print $0} - -END{} - -' < "$1" - + sed -n '/^diff /,$p' < "$1" - } - - # usage: do_get_header patchfile + +/^(diff |--- )/ {patch = 1} + patch == 1 {print $0} + END{} + ' < "$1" --