From: Johannes Schindelin <hidden> Date: 2016-06-15 22:44:37
When rebasing fails during "pull --rebase", you cannot just clean up the
working directory and call "pull --rebase" again, since the remote branch
was already fetched.
Therefore, die early when the working directory is dirty.
Signed-off-by: Johannes Schindelin <redacted>
---
git-pull.sh | 5 +++++
t/t5520-pull.sh | 18 ++++++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
@@ -107,6 +107,11 @@ error_on_no_merge_candidates () {}testtrue="$rebase"&&{+gitupdate-index--refresh&&+gitdiff-files--quiet&&+gitdiff-index--cached--quietHEAD--||+die"refusing to pull with rebase: your working tree is not up-to-date"+.git-parse-remote&&origin="$1"test-z"$origin"&&origin=$(get_default_remote)
@@ -92,4 +92,22 @@ test_expect_success '--rebase with rebased upstream' ''+test_expect_success'pull --rebase dies early with dirty working directory''++gitupdate-refrefs/remotes/me/copycopy^&&+COPY=$(gitrev-parse--verifyme/copy)&&+gitrebase--onto$COPYcopy&&+gitconfigbranch.to-rebase.remoteme&&+gitconfigbranch.to-rebase.mergerefs/heads/copy&&+gitconfigbranch.to-rebase.rebasetrue&&+echodirty>>file&&+gitaddfile&&+test_must_failgitpull&&+test$COPY=$(gitrev-parse--verifyme/copy)&&+gitcheckoutHEAD--file&&+gitpull&&+test$COPY!=$(gitrev-parse--verifyme/copy)++'+ test_done
From: Andreas Ericsson <hidden> Date: 2016-06-15 22:44:37
Johannes Schindelin wrote:
When rebasing fails during "pull --rebase", you cannot just clean up the
working directory and call "pull --rebase" again, since the remote branch
was already fetched.
Therefore, die early when the working directory is dirty.
Funny stuff. I helped a co-worker with just exactly this issue less than
ten minutes ago, so, fwiw:
Liked-by: Andreas Ericsson [off-list ref]
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
From: Jan Krüger <hidden> Date: 2016-06-15 22:44:37
Hi,
When rebasing fails during "pull --rebase", you cannot just clean up
the working directory and call "pull --rebase" again, since the
remote branch was already fetched.
Therefore, die early when the working directory is dirty.
Good idea.
+ git update-index --refresh &&
+ git diff-files --quiet &&
+ git diff-index --cached --quiet HEAD -- ||
+ die "refusing to pull with rebase: your working tree is not
up-to-date"
Perhaps the "up-to-date" should be changed to something else, following
the recent discussion about the "up-to-date" message in checkout (but
here we don't have to worry about breaking anything else). In that case,
I'd suggest:
"Refusing to pull with rebase: your working tree has uncommitted
changes"
--
Best regards
Jan Krüger [off-list ref]
On May 21, 2008, at 07:32, Johannes Schindelin wrote:
When rebasing fails during "pull --rebase", you cannot just clean up
the
working directory and call "pull --rebase" again, since the remote
branch
was already fetched.
Therefore, die early when the working directory is dirty.
Much nicer indeed to die early on errors, as we also can
generally give better error messages.
+ die "refusing to pull with rebase: your working tree is not up-to-
date"
I thought we'd prefer saying:
"refusing to pull with rebase: your working tree has
local changes"
-Geert