summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dee2775)
raw | patch | inline | side by side (parent: dee2775)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Wed, 21 May 2008 11:32:16 +0000 (12:32 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 23 May 2008 06:05:11 +0000 (23:05 -0700) |
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 <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-pull.sh | patch | blob | history | |
t/t5520-pull.sh | patch | blob | history |
diff --git a/git-pull.sh b/git-pull.sh
index bf0c2985af875cdb7b2c64998390dbee908ff14c..809e537a4d81233966aad23df11c13931d6250c1 100755 (executable)
--- a/git-pull.sh
+++ b/git-pull.sh
}
test true = "$rebase" && {
+ 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"
+
. git-parse-remote &&
origin="$1"
test -z "$origin" && origin=$(get_default_remote)
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 9484129ca5aafab369a6ee1f7a1264d568f8cb44..997b2db827c4f37512c6b5d2f861e12105e2a32d 100755 (executable)
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
'
+test_expect_success 'pull --rebase dies early with dirty working directory' '
+
+ git update-ref refs/remotes/me/copy copy^ &&
+ COPY=$(git rev-parse --verify me/copy) &&
+ git rebase --onto $COPY copy &&
+ git config branch.to-rebase.remote me &&
+ git config branch.to-rebase.merge refs/heads/copy &&
+ git config branch.to-rebase.rebase true &&
+ echo dirty >> file &&
+ git add file &&
+ test_must_fail git pull &&
+ test $COPY = $(git rev-parse --verify me/copy) &&
+ git checkout HEAD -- file &&
+ git pull &&
+ test $COPY != $(git rev-parse --verify me/copy)
+
+'
+
test_done