rebase --autostash: fix issue with dirty submodules

Since we cannot stash dirty submodules, there is no use in requiring them to be clean (or stash them when they are not). This brings the built-in rebase in line with the previous, scripted version, which also did not care about dirty submodules (but it was admittedly not very easy to figure that out). This fixes https://github.com/git-for-windows/git/issues/1820 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Oct 23, 2018 at 12:57 UTC ffae8b2f904f0a82417ac24cb2684bbe5ca234e1
2 files changed +2 -2
builtin/rebase.c
+1 -1
@@ -1350,7 +1350,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1350 update_index_if_able(&the_index, &lock_file);
1351 rollback_lock_file(&lock_file);
1352
1353 - if (has_unstaged_changes(0) || has_uncommitted_changes(0)) {
1353 + if (has_unstaged_changes(1) || has_uncommitted_changes(1)) {
1354 const char *autostash =
1355 state_dir_path("autostash", &options);
1356 struct child_process stash = CHILD_PROCESS_INIT;
t/t3420-rebase-autostash.sh
+1 -1
@@ -351,7 +351,7 @@ test_expect_success 'autostash is saved on editor failure with conflict' '
351 test_cmp expected file0
352 '
353
354 -test_expect_failure 'autostash with dirty submodules' '
354 +test_expect_success 'autostash with dirty submodules' '
355 test_when_finished "git reset --hard && git checkout master" &&
356 git checkout -b with-submodule &&
357 git submodule add ./ sub &&