Merge branch 'pc/submodule-helper'
[gitweb.git] / sequencer.c
index 7886e2269eb7813cdf9f908002ec70a9561a153c..7c874be1c61359a929307abe9d240ba01bd588c3 100644 (file)
@@ -1184,7 +1184,6 @@ static int read_and_refresh_cache(struct replay_opts *opts)
        refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
        if (the_index.cache_changed && index_fd >= 0) {
                if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK)) {
-                       rollback_lock_file(&index_lock);
                        return error(_("git %s: failed to refresh the index"),
                                _(action_name(opts)));
                }
@@ -1862,12 +1861,15 @@ static int error_failed_squash(struct commit *commit,
 
 static int do_exec(const char *command_line)
 {
+       struct argv_array child_env = ARGV_ARRAY_INIT;
        const char *child_argv[] = { NULL, NULL };
        int dirty, status;
 
        fprintf(stderr, "Executing: %s\n", command_line);
        child_argv[0] = command_line;
-       status = run_command_v_opt(child_argv, RUN_USING_SHELL);
+       argv_array_pushf(&child_env, "GIT_DIR=%s", absolute_path(get_git_dir()));
+       status = run_command_v_opt_cd_env(child_argv, RUN_USING_SHELL, NULL,
+                                         child_env.argv);
 
        /* force re-reading of the cache */
        if (discard_cache() < 0 || read_cache() < 0)
@@ -1897,6 +1899,8 @@ static int do_exec(const char *command_line)
                status = 1;
        }
 
+       argv_array_clear(&child_env);
+
        return status;
 }
 
@@ -2558,7 +2562,7 @@ static enum check_level get_missing_commit_check_level(void)
                return CHECK_WARN;
        if (!strcasecmp("error", value))
                return CHECK_ERROR;
-       warning(_("unrecognized setting %s for option"
+       warning(_("unrecognized setting %s for option "
                  "rebase.missingCommitsCheck. Ignoring."), value);
        return CHECK_IGNORE;
 }
@@ -2948,9 +2952,9 @@ int rearrange_squash(void)
                if (fd < 0)
                        res = error_errno(_("could not open '%s'"), todo_file);
                else if (write(fd, buf.buf, buf.len) < 0)
-                       res = error_errno(_("could not read '%s'."), todo_file);
+                       res = error_errno(_("could not write to '%s'"), todo_file);
                else if (ftruncate(fd, buf.len) < 0)
-                       res = error_errno(_("could not finish '%s'"),
+                       res = error_errno(_("could not truncate '%s'"),
                                           todo_file);
                close(fd);
                strbuf_release(&buf);