summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e73f2b2)
raw | patch | inline | side by side (parent: e73f2b2)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 1 Oct 2008 15:39:52 +0000 (17:39 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 1 Oct 2008 15:39:52 +0000 (17:39 +0200) |
tig.c | patch | blob | history |
index 0360e173457a455d4d266b46ee338ac19e4fefba..e22d33de5205e10cbb4bc41b05a4e7a3f4c0ef20 100644 (file)
--- a/tig.c
+++ b/tig.c
update_view_title(view);
}
-static void
+static bool
run_confirm(const char *cmd, const char *prompt)
{
- if (prompt_yesno(prompt)) {
+ bool confirmation = prompt_yesno(prompt);
+
+ if (confirmation)
system(cmd);
- }
+
+ return confirmation;
}
static void
char cmd[SIZEOF_STR];
char file_sq[SIZEOF_STR];
- if (sq_quote(file_sq, 0, status->old.name) < sizeof(file_sq) &&
- string_format(cmd, "git checkout %s%s", opt_cdup, file_sq)) {
- run_confirm(cmd, "Are you sure you want to overwrite any changes?");
- }
+ if (sq_quote(file_sq, 0, status->old.name) >= sizeof(file_sq) ||
+ !string_format(cmd, "git checkout %s%s", opt_cdup, file_sq))
+ return FALSE;
- return TRUE;
+ return run_confirm(cmd, "Are you sure you want to overwrite any changes?");
}
}