static char *logfile, *force_author, *template_file;
static char *edit_message, *use_message;
static int all, edit_flag, also, interactive, only, amend, signoff;
-static int quiet, verbose, untracked_files, no_verify;
+static int quiet, verbose, untracked_files, no_verify, allow_empty;
static int no_edit, initial_commit, in_merge;
const char *only_include_assumed;
OPT_BOOLEAN('n', "no-verify", &no_verify, "bypass pre-commit hook"),
OPT_BOOLEAN(0, "amend", &amend, "amend previous commit"),
OPT_BOOLEAN(0, "untracked-files", &untracked_files, "show all untracked files"),
+ OPT_BOOLEAN(0, "allow-empty", &allow_empty, "ok to record an empty change"),
OPT_END()
};
}
}
-static char *prepare_index(const char **files, const char *prefix)
+static char *prepare_index(int argc, const char **argv, const char *prefix)
{
int fd;
struct tree *tree;
const char **pathspec = NULL;
if (interactive) {
- interactive_add();
+ interactive_add(argc, argv, prefix);
commit_style = COMMIT_AS_IS;
return get_index_file();
}
if (read_cache() < 0)
die("index file corrupt");
- if (*files)
- pathspec = get_pathspec(prefix, files);
+ if (*argv)
+ pathspec = get_pathspec(prefix, argv);
/*
* Non partial, non as-is commit.
argc = parse_and_validate_options(argc, argv, builtin_status_usage);
- index_file = prepare_index(argv, prefix);
+ index_file = prepare_index(argc, argv, prefix);
commitable = run_status(stdout, index_file, prefix);
argc = parse_and_validate_options(argc, argv, builtin_commit_usage);
- index_file = prepare_index(argv, prefix);
+ index_file = prepare_index(argc, argv, prefix);
if (!no_verify && run_hook(index_file, "pre-commit", NULL)) {
rollback_index_files();
}
if (!prepare_log_message(index_file, prefix) && !in_merge &&
- !(amend && is_a_merge(head_sha1))) {
+ !allow_empty && !(amend && is_a_merge(head_sha1))) {
run_status(stdout, index_file, prefix);
rollback_index_files();
unlink(commit_editmsg);