From ea035bcbfddb6d67f10cb49412202b8f1ecb3713 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Sun, 4 Jan 2009 20:26:24 -0500 Subject: [PATCH] IO API: convert status checkout/revert support --- tig.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/tig.c b/tig.c index 9a7a3a7..d771809 100644 --- a/tig.c +++ b/tig.c @@ -2832,17 +2832,6 @@ open_view(struct view *prev, enum request request, enum open_flags flags) update_view_title(view); } -static bool -run_confirm(const char *cmd, const char *prompt) -{ - bool confirmation = prompt_yesno(prompt); - - if (confirmation) - system(cmd); - - return confirmation; -} - static void open_external_viewer(const char *argv[], const char *dir) { @@ -4658,14 +4647,13 @@ status_revert(struct status *status, enum line_type type, bool has_none) return FALSE; } else { - char cmd[SIZEOF_STR]; - char file_sq[SIZEOF_STR]; + const char *checkout_argv[] = { + "git", "checkout", "--", status->old.name, NULL + }; - if (sq_quote(file_sq, 0, status->old.name) >= sizeof(file_sq) || - !string_format(cmd, "git checkout -- %s%s", opt_cdup, file_sq)) + if (!prompt_yesno("Are you sure you want to overwrite any changes?")) return FALSE; - - return run_confirm(cmd, "Are you sure you want to overwrite any changes?"); + return run_io_fg(checkout_argv, opt_cdup); } } -- 2.30.2