/* update the user index file */
add_files_to_cache(verbose, prefix, files);
+ refresh_cache(REFRESH_QUIET);
if (write_cache(fd, active_cache, active_nr) || close(fd))
die("unable to write new_index file");
static int prepare_log_message(const char *index_file, const char *prefix)
{
struct stat statbuf;
- int commitable;
+ int commitable, saved_color_setting;
struct strbuf sb;
char *buffer;
FILE *fp;
if (only_include_assumed)
fprintf(fp, "# %s\n", only_include_assumed);
+ saved_color_setting = wt_status_use_color;
+ wt_status_use_color = 0;
commitable = run_status(fp, index_file, prefix);
+ wt_status_use_color = saved_color_setting;
fclose(fp);
printf("Created %scommit ", initial_commit ? "initial " : "");
log_tree_commit(&rev, commit);
+ printf("\n");
}
int git_commit_config(const char *k, const char *v)
int cmd_commit(int argc, const char **argv, const char *prefix)
{
- int header_len, parent_count = 0;
+ int header_len;
struct strbuf sb;
const char *index_file, *reflog_msg;
char *nl;
/* Determine parents */
if (initial_commit) {
reflog_msg = "commit (initial)";
- parent_count = 0;
} else if (amend) {
struct commit_list *c;
struct commit *commit;
/* Get the commit message and validate it */
header_len = sb.len;
- if (!no_edit) {
- fprintf(stderr, "launching editor, log %s\n", logfile);
+ if (!no_edit)
launch_editor(git_path(commit_editmsg), &sb);
- } else if (strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0)
+ else if (strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0)
die("could not read commit message\n");
- if (run_hook(index_file, "commit-msg", commit_editmsg))
+ if (run_hook(index_file, "commit-msg", git_path(commit_editmsg)))
exit(1);
stripspace(&sb, 1);
if (sb.len < header_len ||