All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH 2/2] rebase --autostash: fix issue with dirty submodules
Date: Tue, 23 Oct 2018 12:57:17 -0700 (PDT)	[thread overview]
Message-ID: <ee4b715284c95698fd1b68dc4b1a2d38056df56b.1540324633.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.56.git.gitgitgadget@gmail.com>

From: Johannes Schindelin <johannes.schindelin@gmx.de>

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>
---
 builtin/rebase.c            | 2 +-
 t/t3420-rebase-autostash.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin/rebase.c b/builtin/rebase.c
index 09f55bfb9..1dd24301f 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1349,7 +1349,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;
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index 7eb9f9041..f355c6825 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -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 &&
-- 
gitgitgadget

  parent reply	other threads:[~2018-10-23 19:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23 19:57 [PATCH 0/2] Demonstrate and fix a rebase --autostash bug with dirty submodules Johannes Schindelin via GitGitGadget
2018-10-23 19:57 ` [PATCH 1/2] rebase --autostash: demonstrate a problem " Johannes Schindelin via GitGitGadget
2018-10-23 19:57 ` Johannes Schindelin via GitGitGadget [this message]
2018-11-06 13:59 ` Regression in rebase-in-C with rebase.autoStash=true Ævar Arnfjörð Bjarmason
2018-11-06 19:32   ` Jeff King
2018-11-07 13:50   ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee4b715284c95698fd1b68dc4b1a2d38056df56b.1540324633.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.