rebase --autostash: fix issue with dirty submodules
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Tue, 23 Oct 2018 19:57:17 +0000 (12:57 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Oct 2018 04:38:15 +0000 (13:38 +0900)
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>
builtin/rebase.c
t/t3420-rebase-autostash.sh
index e9995c9a37251d30e5a08c63a8545d84ab88e14f..bc92c9b5299de3d72378f67371e0d42990385ea7 100644 (file)
@@ -1350,7 +1350,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;
index b6e18566b5609e82eb954d156eed21076f475bdf..001d6243c9afd5368f6c4e38a7cb221df6810995 100755 (executable)
@@ -351,7 +351,7 @@ test_expect_success 'autostash is saved on editor failure with conflict' '
        test_cmp expected file0
 '
 
-test_expect_failure 'autostash with dirty submodules' '
+test_expect_success 'autostash with dirty submodules' '
        test_when_finished "git reset --hard && git checkout master" &&
        git checkout -b with-submodule &&
        git submodule add ./ sub &&