summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ffccf1b)
raw | patch | inline | side by side (parent: ffccf1b)
author | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 19 Nov 2009 03:02:45 +0000 (22:02 -0500) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 19 Nov 2009 03:03:29 +0000 (22:03 -0500) |
tig.c | patch | blob | history |
index 9e76ea0c21afb2b3987c94677588685f752b7dd6..222b3698de6bcc60395ab74519b4c9048e2e5ed6 100644 (file)
--- a/tig.c
+++ b/tig.c
} else {
report("Cannot revert changes to multiple files");
}
- return FALSE;
- } else {
+ } else if (prompt_yesno("Are you sure you want to revert changes?")) {
char mode[10] = "100644";
const char *reset_argv[] = {
"git", "update-index", "--cacheinfo", mode,
"git", "checkout", "--", status->old.name, NULL
};
- if (!prompt_yesno("Are you sure you want to overwrite any changes?"))
- return FALSE;
- string_format(mode, "%o", status->old.mode);
- return (status->status != 'U' || run_io_fg(reset_argv, opt_cdup)) &&
- run_io_fg(checkout_argv, opt_cdup);
+ if (status->status == 'U') {
+ string_format(mode, "%5o", status->old.mode);
+
+ if (status->old.mode == 0 && status->new.mode == 0) {
+ reset_argv[2] = "--force-remove";
+ reset_argv[3] = status->old.name;
+ reset_argv[4] = NULL;
+ }
+
+ if (!run_io_fg(reset_argv, opt_cdup))
+ return FALSE;
+ if (status->old.mode == 0 && status->new.mode == 0)
+ return TRUE;
+ }
+
+ return run_io_fg(checkout_argv, opt_cdup);
}
+
+ return FALSE;
}
static enum request