| 3861 | } |
| 3862 | |
| 3863 | static int do_exec(struct repository *r, const char *command_line, int quiet) |
| 3864 | { |
| 3865 | struct child_process cmd = CHILD_PROCESS_INIT; |
| 3866 | int dirty, status; |
| 3867 | |
| 3868 | if (!quiet) |
| 3869 | fprintf(stderr, _("Executing: %s\n"), command_line); |
| 3870 | cmd.use_shell = 1; |
| 3871 | strvec_push(&cmd.args, command_line); |
| 3872 | strvec_push(&cmd.env, "GIT_CHERRY_PICK_HELP"); |
| 3873 | status = run_command(&cmd); |
| 3874 | |
| 3875 | /* force re-reading of the cache */ |
| 3876 | discard_index(r->index); |
| 3877 | if (repo_read_index(r) < 0) |
| 3878 | return error(_("could not read index")); |
| 3879 | |
| 3880 | dirty = require_clean_work_tree(r, "rebase", NULL, 1, 1); |
| 3881 | |
| 3882 | if (status) { |
| 3883 | warning(_("execution failed: %s\n%s" |
| 3884 | "You can fix the problem, and then run\n" |
| 3885 | "\n" |
| 3886 | " git rebase --continue\n" |
| 3887 | "\n"), |
| 3888 | command_line, |
| 3889 | dirty ? _("and made changes to the index and/or the " |
| 3890 | "working tree.\n") : ""); |
| 3891 | if (status == 127) |
| 3892 | /* command not found */ |
| 3893 | status = 1; |
| 3894 | } else if (dirty) { |
| 3895 | warning(_("execution succeeded: %s\nbut " |
| 3896 | "left changes to the index and/or the working tree.\n" |
| 3897 | "Commit or stash your changes, and then run\n" |
| 3898 | "\n" |
| 3899 | " git rebase --continue\n" |
| 3900 | "\n"), command_line); |
| 3901 | status = 1; |
| 3902 | } |
| 3903 | |
| 3904 | return status; |
| 3905 | } |
| 3906 | |
| 3907 | __attribute__((format (printf, 2, 3))) |
| 3908 | static int safe_append(const char *filename, const char *fmt, ...) |
no test coverage detected