summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-02 02:04:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-02 02:04:58 (GMT)
commitb78c5fe96cadf10c49b968b716a913acf43cc28e (patch)
tree2ba9f0199e97bbd1c591eb0f420ef139b5b087fd /builtin
parent9d322282e4a5be1c908d73c8039f99cb9950f8f3 (diff)
parentffae8b2f904f0a82417ac24cb2684bbe5ca234e1 (diff)
downloadgit-b78c5fe96cadf10c49b968b716a913acf43cc28e.zip
git-b78c5fe96cadf10c49b968b716a913acf43cc28e.tar.gz
git-b78c5fe96cadf10c49b968b716a913acf43cc28e.tar.bz2
Merge branch 'js/rebase-autostash-fix'
"git rebase" that has recently been rewritten in C had a few issues in its "--autstash" feature, which have been corrected. * js/rebase-autostash-fix: rebase --autostash: fix issue with dirty submodules rebase --autostash: demonstrate a problem with dirty submodules rebase (autostash): use an explicit OID to apply the stash rebase (autostash): store the full OID in <state-dir>/autostash rebase (autostash): avoid duplicate call to state_dir_path()
Diffstat (limited to 'builtin')
-rw-r--r--builtin/rebase.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 313a826..d8e4e0e 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -251,8 +251,10 @@ static int apply_autostash(struct rebase_options *opts)
if (!file_exists(path))
return 0;
- if (read_one(state_dir_path("autostash", opts), &autostash))
+ if (read_one(path, &autostash))
return error(_("Could not read '%s'"), path);
+ /* Ensure that the hash is not mistaken for a number */
+ strbuf_addstr(&autostash, "^0");
argv_array_pushl(&stash_apply.args,
"stash", "apply", autostash.buf, NULL);
stash_apply.git_cmd = 1;
@@ -1349,7 +1351,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
update_index_if_able(&the_index, &lock_file);
rollback_lock_file(&lock_file);
- if (has_unstaged_changes(0) || has_uncommitted_changes(0)) {
+ if (has_unstaged_changes(1) || has_uncommitted_changes(1)) {
const char *autostash =
state_dir_path("autostash", &options);
struct child_process stash = CHILD_PROCESS_INIT;
@@ -1375,7 +1377,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
if (safe_create_leading_directories_const(autostash))
die(_("Could not create directory for '%s'"),
options.state_dir);
- write_file(autostash, "%s", buf.buf);
+ write_file(autostash, "%s", oid_to_hex(&oid));
printf(_("Created autostash: %s\n"), buf.buf);
if (reset_head(&head->object.oid, "reset --hard",
NULL, 0, NULL, NULL) < 0)