From: Sven Eden Date: Tue, 15 May 2018 06:22:08 +0000 (+0200) Subject: migrate_tree.pl: Call 'git am --abort' if it failed to apply. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=5839b379233b6d95970abb83944ce6aed49c7da1;p=elogind.git migrate_tree.pl: Call 'git am --abort' if it failed to apply. --- diff --git a/pwx/migrate_tree.pl b/pwx/migrate_tree.pl index ea744c386..02960963b 100755 --- a/pwx/migrate_tree.pl +++ b/pwx/migrate_tree.pl @@ -265,15 +265,14 @@ sub apply_patch { # --------------------------------------------------------------- my $result = 1; try { - @lGitRes = $git->am( - { + @lGitRes = $git->am( { "3" => 1, - stdin => 1, -STDIN => $patch_lines } ); } catch { # We try again without 3-way-merging - show_prg( sprintf("Applying %s (2nd try)"), basename($pFile) ); + $git->am( { "abort" => 1 } ); + show_prg( sprintf("Applying %s (2nd try)", basename($pFile) ) ); $result = 0; }; $result and return $result; @@ -281,13 +280,12 @@ sub apply_patch { # --- 3) Try to apply the patch without 3-way-merging --- # --------------------------------------------------------------- try { - @lGitRes = $git->am( - { - stdin => 1, + @lGitRes = $git->am( { -STDIN => $patch_lines } ); $result = 1; } catch { + $git->am( { "abort" => 1 } ); print "\nERROR: Couldn't apply $pFile\n"; print "Exit Code : " . $_->status . "\n"; print "Message : " . $_->error . "\n";