-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: stg import --reject should create empty commit
When trying to import a patch that does not apply cleanly, and using --reject option, stg should apply what it can, leave the rest in .rej files, and create an empty commit. The work to apply the patch is outsourced to "git apply --reject" which exits with status code 1 if patch is applied partially and it is treated as error by stg import. Fix the issue by not treating return code of 1 from "git apply" as an error when "--reject" option is specified, but rather saving its output, printing it for the user, and continuing with the rest of the import logic. Exit with CONFLICT_ERROR rather than COMMAND_ERROR when the patch does not import/apply cleanly. "stg fold" reuses much of the same code so it has to be adjusted in the similar fashion. It will also exit with CONFLICT_ERROR when a patch does not apply cleanly. Also add a test case and fix up documentation for "stg import" and adjust test case for "stg fold". Closes: #471 Signed-off-by: Dmitry Torokhov <dtor@google.com>
- Loading branch information
Showing
6 changed files
with
114 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
test patch with rejects | ||
|
||
--- | ||
|
||
t/t1800/foo.txt | 4 ++-- | ||
1 file changed, 2 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/t/t1800/foo.txt b/t/t1800/foo.txt | ||
index ad01662f..d609de80 100644 | ||
--- a/foo.txt | ||
+++ b/foo.txt | ||
@@ -6,7 +6,7 @@ dobidim | ||
dobidum | ||
dobodam | ||
dobodim | ||
-dobodum | ||
+dObodum | ||
dibedam | ||
dibedim | ||
dibedum | ||
@@ -18,7 +18,7 @@ dibodim | ||
dibodum | ||
dabedam | ||
dabedim | ||
-Dabedum | ||
+dAbedum | ||
dabidam | ||
dabidim | ||
dabidum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters