2006-11-16 22:47:22 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='pulling into void'
|
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
2010-08-13 05:50:49 +04:00
|
|
|
modify () {
|
|
|
|
sed -e "$1" <"$2" >"$2.x" &&
|
|
|
|
mv "$2.x" "$2"
|
|
|
|
}
|
|
|
|
|
2006-11-16 22:47:22 +03:00
|
|
|
test_expect_success setup '
|
|
|
|
echo file >file &&
|
|
|
|
git add file &&
|
|
|
|
git commit -a -m original
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'pulling into void' '
|
2015-04-23 23:29:14 +03:00
|
|
|
git init cloned &&
|
|
|
|
(
|
|
|
|
cd cloned &&
|
|
|
|
git pull ..
|
|
|
|
) &&
|
2006-11-16 22:47:22 +03:00
|
|
|
test -f file &&
|
|
|
|
test -f cloned/file &&
|
2010-05-14 13:31:37 +04:00
|
|
|
test_cmp file cloned/file
|
2006-11-16 22:47:22 +03:00
|
|
|
'
|
|
|
|
|
2008-10-15 02:32:20 +04:00
|
|
|
test_expect_success 'pulling into void using master:master' '
|
2015-04-23 23:29:14 +03:00
|
|
|
git init cloned-uho &&
|
2008-10-15 02:32:20 +04:00
|
|
|
(
|
|
|
|
cd cloned-uho &&
|
|
|
|
git pull .. master:master
|
|
|
|
) &&
|
|
|
|
test -f file &&
|
|
|
|
test -f cloned-uho/file &&
|
|
|
|
test_cmp file cloned-uho/file
|
|
|
|
'
|
|
|
|
|
2011-03-25 21:13:31 +03:00
|
|
|
test_expect_success 'pulling into void does not overwrite untracked files' '
|
|
|
|
git init cloned-untracked &&
|
|
|
|
(
|
|
|
|
cd cloned-untracked &&
|
|
|
|
echo untracked >file &&
|
|
|
|
test_must_fail git pull .. master &&
|
|
|
|
echo untracked >expect &&
|
|
|
|
test_cmp expect file
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
pull: merge into unborn by fast-forwarding from empty tree
The logic for pulling into an unborn branch was originally
designed to be used on a newly-initialized repository
(d09e79c, git-pull: allow pulling into an empty repository,
2006-11-16). It thus did not initially deal with
uncommitted changes in the unborn branch. The case of an
_unstaged_ untracked file was fixed by 4b3ffe5 (pull: do not
clobber untracked files on initial pull, 2011-03-25).
However, it still clobbered existing staged files, both when
the file exists in the merged commit (it will be
overwritten), and when it does not (it will be deleted).
We fix this by doing a two-way merge, where the "current"
side of the merge is an empty tree, and the "target" side is
HEAD (already updated to FETCH_HEAD at this point). This
amounts to claiming that all work in the index was done vs.
an empty tree, and thus all content of the index is
precious.
Note that this use of read-tree just gives us protection
against overwriting index and working tree changes. It will
not actually result in a 3-way merge conflict in the index.
This is fine, as this is a rare situation, and the conflict
would not be interesting anyway (it must, by definition, be
an add/add conflict with the whole content conflicting). And
it makes it simpler for the user to recover, as they have no
HEAD to "git reset" back to.
Reported-by: Stefan Schüßler <mail@stefanschuessler.de>
Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-21 02:38:28 +04:00
|
|
|
test_expect_success 'pulling into void does not overwrite staged files' '
|
|
|
|
git init cloned-staged-colliding &&
|
|
|
|
(
|
|
|
|
cd cloned-staged-colliding &&
|
|
|
|
echo "alternate content" >file &&
|
|
|
|
git add file &&
|
|
|
|
test_must_fail git pull .. master &&
|
|
|
|
echo "alternate content" >expect &&
|
|
|
|
test_cmp expect file &&
|
|
|
|
git cat-file blob :file >file.index &&
|
|
|
|
test_cmp expect file.index
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'pulling into void does not remove new staged files' '
|
|
|
|
git init cloned-staged-new &&
|
|
|
|
(
|
|
|
|
cd cloned-staged-new &&
|
|
|
|
echo "new tracked file" >newfile &&
|
|
|
|
git add newfile &&
|
|
|
|
git pull .. master &&
|
|
|
|
echo "new tracked file" >expect &&
|
|
|
|
test_cmp expect newfile &&
|
|
|
|
git cat-file blob :newfile >newfile.index &&
|
|
|
|
test_cmp expect newfile.index
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
2015-04-23 23:34:08 +03:00
|
|
|
test_expect_success 'pulling into void must not create an octopus' '
|
|
|
|
git init cloned-octopus &&
|
|
|
|
(
|
|
|
|
cd cloned-octopus &&
|
|
|
|
test_must_fail git pull .. master master &&
|
|
|
|
! test -f file
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
git-fetch, git-branch: Support local --track via a special remote '.'
This patch adds support for a dummy remote '.' to avoid having
to declare a fake remote like
[remote "local"]
url = .
fetch = refs/heads/*:refs/heads/*
Such a builtin remote simplifies the operation of "git-fetch",
which will populate FETCH_HEAD but will not pretend that two
repositories are in use, will not create a thin pack, and will
not perform any useless remapping of names. The speed
improvement is around 20%, and it should improve more if
"git-fetch" is converted to a builtin.
To this end, git-parse-remote is grown with a new kind of
remote, 'builtin'. In git-fetch.sh, we treat the builtin remote
specially in that it needs no pack/store operations. In fact,
doing git-fetch on a builtin remote will simply populate
FETCH_HEAD appropriately.
The patch also improves of the --track/--no-track support,
extending it so that branch.<name>.remote items referring '.'
can be created. Finally, it fixes a typo in git-checkout.sh.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-15 11:23:20 +03:00
|
|
|
test_expect_success 'test . as a remote' '
|
|
|
|
git branch copy master &&
|
|
|
|
git config branch.copy.remote . &&
|
|
|
|
git config branch.copy.merge refs/heads/master &&
|
|
|
|
echo updated >file &&
|
|
|
|
git commit -a -m updated &&
|
|
|
|
git checkout copy &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$(cat file)" = file &&
|
git-fetch, git-branch: Support local --track via a special remote '.'
This patch adds support for a dummy remote '.' to avoid having
to declare a fake remote like
[remote "local"]
url = .
fetch = refs/heads/*:refs/heads/*
Such a builtin remote simplifies the operation of "git-fetch",
which will populate FETCH_HEAD but will not pretend that two
repositories are in use, will not create a thin pack, and will
not perform any useless remapping of names. The speed
improvement is around 20%, and it should improve more if
"git-fetch" is converted to a builtin.
To this end, git-parse-remote is grown with a new kind of
remote, 'builtin'. In git-fetch.sh, we treat the builtin remote
specially in that it needs no pack/store operations. In fact,
doing git-fetch on a builtin remote will simply populate
FETCH_HEAD appropriately.
The patch also improves of the --track/--no-track support,
extending it so that branch.<name>.remote items referring '.'
can be created. Finally, it fixes a typo in git-checkout.sh.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-15 11:23:20 +03:00
|
|
|
git pull &&
|
2015-05-29 14:44:45 +03:00
|
|
|
test "$(cat file)" = updated &&
|
|
|
|
git reflog -1 >reflog.actual &&
|
|
|
|
sed "s/^[0-9a-f][0-9a-f]*/OBJID/" reflog.actual >reflog.fuzzy &&
|
|
|
|
echo "OBJID HEAD@{0}: pull: Fast-forward" >reflog.expected &&
|
|
|
|
test_cmp reflog.expected reflog.fuzzy
|
git-fetch, git-branch: Support local --track via a special remote '.'
This patch adds support for a dummy remote '.' to avoid having
to declare a fake remote like
[remote "local"]
url = .
fetch = refs/heads/*:refs/heads/*
Such a builtin remote simplifies the operation of "git-fetch",
which will populate FETCH_HEAD but will not pretend that two
repositories are in use, will not create a thin pack, and will
not perform any useless remapping of names. The speed
improvement is around 20%, and it should improve more if
"git-fetch" is converted to a builtin.
To this end, git-parse-remote is grown with a new kind of
remote, 'builtin'. In git-fetch.sh, we treat the builtin remote
specially in that it needs no pack/store operations. In fact,
doing git-fetch on a builtin remote will simply populate
FETCH_HEAD appropriately.
The patch also improves of the --track/--no-track support,
extending it so that branch.<name>.remote items referring '.'
can be created. Finally, it fixes a typo in git-checkout.sh.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-15 11:23:20 +03:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'the default remote . should not break explicit pull' '
|
|
|
|
git checkout -b second master^ &&
|
|
|
|
echo modified >file &&
|
|
|
|
git commit -a -m modified &&
|
|
|
|
git checkout copy &&
|
|
|
|
git reset --hard HEAD^ &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$(cat file)" = file &&
|
git-fetch, git-branch: Support local --track via a special remote '.'
This patch adds support for a dummy remote '.' to avoid having
to declare a fake remote like
[remote "local"]
url = .
fetch = refs/heads/*:refs/heads/*
Such a builtin remote simplifies the operation of "git-fetch",
which will populate FETCH_HEAD but will not pretend that two
repositories are in use, will not create a thin pack, and will
not perform any useless remapping of names. The speed
improvement is around 20%, and it should improve more if
"git-fetch" is converted to a builtin.
To this end, git-parse-remote is grown with a new kind of
remote, 'builtin'. In git-fetch.sh, we treat the builtin remote
specially in that it needs no pack/store operations. In fact,
doing git-fetch on a builtin remote will simply populate
FETCH_HEAD appropriately.
The patch also improves of the --track/--no-track support,
extending it so that branch.<name>.remote items referring '.'
can be created. Finally, it fixes a typo in git-checkout.sh.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-15 11:23:20 +03:00
|
|
|
git pull . second &&
|
2015-05-29 14:44:45 +03:00
|
|
|
test "$(cat file)" = modified &&
|
|
|
|
git reflog -1 >reflog.actual &&
|
|
|
|
sed "s/^[0-9a-f][0-9a-f]*/OBJID/" reflog.actual >reflog.fuzzy &&
|
|
|
|
echo "OBJID HEAD@{0}: pull . second: Fast-forward" >reflog.expected &&
|
|
|
|
test_cmp reflog.expected reflog.fuzzy
|
git-fetch, git-branch: Support local --track via a special remote '.'
This patch adds support for a dummy remote '.' to avoid having
to declare a fake remote like
[remote "local"]
url = .
fetch = refs/heads/*:refs/heads/*
Such a builtin remote simplifies the operation of "git-fetch",
which will populate FETCH_HEAD but will not pretend that two
repositories are in use, will not create a thin pack, and will
not perform any useless remapping of names. The speed
improvement is around 20%, and it should improve more if
"git-fetch" is converted to a builtin.
To this end, git-parse-remote is grown with a new kind of
remote, 'builtin'. In git-fetch.sh, we treat the builtin remote
specially in that it needs no pack/store operations. In fact,
doing git-fetch on a builtin remote will simply populate
FETCH_HEAD appropriately.
The patch also improves of the --track/--no-track support,
extending it so that branch.<name>.remote items referring '.'
can be created. Finally, it fixes a typo in git-checkout.sh.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-15 11:23:20 +03:00
|
|
|
'
|
|
|
|
|
t5520: test no merge candidates cases
a8c9bef (pull: improve advice for unconfigured error case, 2009-10-05)
fully established the current advices given by git-pull for the
different cases where git-fetch will not have anything marked for merge:
1. We fetched from a specific remote, and a refspec was given, but it
ended up not fetching anything. This is usually because the user
provided a wildcard refspec which had no matches on the remote end.
2. We fetched from a non-default remote, but didn't specify a branch to
merge. We can't use the configured one because it applies to the
default remote, and thus the user must specify the branches to merge.
3. We fetched from the branch's or repo's default remote, but:
a. We are not on a branch, so there will never be a configured branch
to merge with.
b. We are on a branch, but there is no configured branch to merge
with.
4. We fetched from the branch's or repo's default remote, but the
configured branch to merge didn't get fetched (either it doesn't
exist, or wasn't part of the configured fetch refspec)
Implement tests for the above 5 cases to ensure that the correct code
paths are triggered for each of these cases.
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-05-18 16:32:52 +03:00
|
|
|
test_expect_success 'fail if wildcard spec does not match any refs' '
|
|
|
|
git checkout -b test copy^ &&
|
|
|
|
test_when_finished "git checkout -f copy && git branch -D test" &&
|
|
|
|
test "$(cat file)" = file &&
|
|
|
|
test_must_fail git pull . "refs/nonexisting1/*:refs/nonexisting2/*" 2>err &&
|
|
|
|
test_i18ngrep "no candidates for merging" err &&
|
|
|
|
test "$(cat file)" = file
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'fail if no branches specified with non-default remote' '
|
|
|
|
git remote add test_remote . &&
|
|
|
|
test_when_finished "git remote remove test_remote" &&
|
|
|
|
git checkout -b test copy^ &&
|
|
|
|
test_when_finished "git checkout -f copy && git branch -D test" &&
|
|
|
|
test "$(cat file)" = file &&
|
|
|
|
test_config branch.test.remote origin &&
|
|
|
|
test_must_fail git pull test_remote 2>err &&
|
|
|
|
test_i18ngrep "specify a branch on the command line" err &&
|
|
|
|
test "$(cat file)" = file
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'fail if not on a branch' '
|
|
|
|
git remote add origin . &&
|
|
|
|
test_when_finished "git remote remove origin" &&
|
|
|
|
git checkout HEAD^ &&
|
|
|
|
test_when_finished "git checkout -f copy" &&
|
|
|
|
test "$(cat file)" = file &&
|
|
|
|
test_must_fail git pull 2>err &&
|
|
|
|
test_i18ngrep "not currently on a branch" err &&
|
|
|
|
test "$(cat file)" = file
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'fail if no configuration for current branch' '
|
|
|
|
git remote add test_remote . &&
|
|
|
|
test_when_finished "git remote remove test_remote" &&
|
|
|
|
git checkout -b test copy^ &&
|
|
|
|
test_when_finished "git checkout -f copy && git branch -D test" &&
|
|
|
|
test_config branch.test.remote test_remote &&
|
|
|
|
test "$(cat file)" = file &&
|
|
|
|
test_must_fail git pull 2>err &&
|
|
|
|
test_i18ngrep "no tracking information" err &&
|
|
|
|
test "$(cat file)" = file
|
|
|
|
'
|
|
|
|
|
2015-06-02 17:22:52 +03:00
|
|
|
test_expect_success 'pull --all: fail if no configuration for current branch' '
|
|
|
|
git remote add test_remote . &&
|
|
|
|
test_when_finished "git remote remove test_remote" &&
|
|
|
|
git checkout -b test copy^ &&
|
|
|
|
test_when_finished "git checkout -f copy && git branch -D test" &&
|
|
|
|
test_config branch.test.remote test_remote &&
|
|
|
|
test "$(cat file)" = file &&
|
|
|
|
test_must_fail git pull --all 2>err &&
|
|
|
|
test_i18ngrep "There is no tracking information" err &&
|
|
|
|
test "$(cat file)" = file
|
|
|
|
'
|
|
|
|
|
t5520: test no merge candidates cases
a8c9bef (pull: improve advice for unconfigured error case, 2009-10-05)
fully established the current advices given by git-pull for the
different cases where git-fetch will not have anything marked for merge:
1. We fetched from a specific remote, and a refspec was given, but it
ended up not fetching anything. This is usually because the user
provided a wildcard refspec which had no matches on the remote end.
2. We fetched from a non-default remote, but didn't specify a branch to
merge. We can't use the configured one because it applies to the
default remote, and thus the user must specify the branches to merge.
3. We fetched from the branch's or repo's default remote, but:
a. We are not on a branch, so there will never be a configured branch
to merge with.
b. We are on a branch, but there is no configured branch to merge
with.
4. We fetched from the branch's or repo's default remote, but the
configured branch to merge didn't get fetched (either it doesn't
exist, or wasn't part of the configured fetch refspec)
Implement tests for the above 5 cases to ensure that the correct code
paths are triggered for each of these cases.
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-05-18 16:32:52 +03:00
|
|
|
test_expect_success 'fail if upstream branch does not exist' '
|
|
|
|
git checkout -b test copy^ &&
|
|
|
|
test_when_finished "git checkout -f copy && git branch -D test" &&
|
|
|
|
test_config branch.test.remote . &&
|
|
|
|
test_config branch.test.merge refs/heads/nonexisting &&
|
|
|
|
test "$(cat file)" = file &&
|
|
|
|
test_must_fail git pull 2>err &&
|
|
|
|
test_i18ngrep "no such ref was fetched" err &&
|
|
|
|
test "$(cat file)" = file
|
|
|
|
'
|
|
|
|
|
2015-05-29 14:44:40 +03:00
|
|
|
test_expect_success 'fail if the index has unresolved entries' '
|
|
|
|
git checkout -b third second^ &&
|
|
|
|
test_when_finished "git checkout -f copy && git branch -D third" &&
|
|
|
|
test "$(cat file)" = file &&
|
|
|
|
test_commit modified2 file &&
|
|
|
|
test -z "$(git ls-files -u)" &&
|
|
|
|
test_must_fail git pull . second &&
|
|
|
|
test -n "$(git ls-files -u)" &&
|
|
|
|
cp file expected &&
|
|
|
|
test_must_fail git pull . second 2>err &&
|
|
|
|
test_i18ngrep "Pull is not possible because you have unmerged files" err &&
|
|
|
|
test_cmp expected file &&
|
|
|
|
git add file &&
|
|
|
|
test -z "$(git ls-files -u)" &&
|
|
|
|
test_must_fail git pull . second 2>err &&
|
|
|
|
test_i18ngrep "You have not concluded your merge" err &&
|
|
|
|
test_cmp expected file
|
|
|
|
'
|
|
|
|
|
2015-05-29 14:44:41 +03:00
|
|
|
test_expect_success 'fast-forwards working tree if branch head is updated' '
|
|
|
|
git checkout -b third second^ &&
|
|
|
|
test_when_finished "git checkout -f copy && git branch -D third" &&
|
|
|
|
test "$(cat file)" = file &&
|
|
|
|
git pull . second:third 2>err &&
|
|
|
|
test_i18ngrep "fetch updated the current branch head" err &&
|
|
|
|
test "$(cat file)" = modified &&
|
|
|
|
test "$(git rev-parse third)" = "$(git rev-parse second)"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'fast-forward fails with conflicting work tree' '
|
|
|
|
git checkout -b third second^ &&
|
|
|
|
test_when_finished "git checkout -f copy && git branch -D third" &&
|
|
|
|
test "$(cat file)" = file &&
|
|
|
|
echo conflict >file &&
|
|
|
|
test_must_fail git pull . second:third 2>err &&
|
|
|
|
test_i18ngrep "Cannot fast-forward your working tree" err &&
|
|
|
|
test "$(cat file)" = conflict &&
|
|
|
|
test "$(git rev-parse third)" = "$(git rev-parse second)"
|
|
|
|
'
|
|
|
|
|
2007-11-28 16:11:07 +03:00
|
|
|
test_expect_success '--rebase' '
|
|
|
|
git branch to-rebase &&
|
|
|
|
echo modified again > file &&
|
|
|
|
git commit -m file file &&
|
|
|
|
git checkout to-rebase &&
|
|
|
|
echo new > file2 &&
|
|
|
|
git add file2 &&
|
|
|
|
git commit -m "new file" &&
|
|
|
|
git tag before-rebase &&
|
|
|
|
git pull --rebase . copy &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
|
|
|
|
test new = "$(git show HEAD:file2)"
|
2007-11-28 16:11:07 +03:00
|
|
|
'
|
2015-05-29 14:44:42 +03:00
|
|
|
|
|
|
|
test_expect_success '--rebase fails with multiple branches' '
|
|
|
|
git reset --hard before-rebase &&
|
|
|
|
test_must_fail git pull --rebase . copy master 2>err &&
|
|
|
|
test "$(git rev-parse HEAD)" = "$(git rev-parse before-rebase)" &&
|
|
|
|
test_i18ngrep "Cannot rebase onto multiple branches" err &&
|
|
|
|
test modified = "$(git show HEAD:file)"
|
|
|
|
'
|
|
|
|
|
2015-07-05 00:42:38 +03:00
|
|
|
test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '
|
|
|
|
test_config rebase.autostash true &&
|
|
|
|
git reset --hard before-rebase &&
|
|
|
|
echo dirty >new_file &&
|
|
|
|
git add new_file &&
|
|
|
|
git pull --rebase . copy &&
|
|
|
|
test_cmp_rev HEAD^ copy &&
|
|
|
|
test "$(cat new_file)" = dirty &&
|
|
|
|
test "$(cat file)" = "modified again"
|
|
|
|
'
|
|
|
|
|
2016-03-21 21:18:03 +03:00
|
|
|
test_expect_success 'pull --rebase --autostash & rebase.autostash=true' '
|
|
|
|
test_config rebase.autostash true &&
|
|
|
|
git reset --hard before-rebase &&
|
|
|
|
echo dirty >new_file &&
|
|
|
|
git add new_file &&
|
|
|
|
git pull --rebase --autostash . copy &&
|
|
|
|
test_cmp_rev HEAD^ copy &&
|
|
|
|
test "$(cat new_file)" = dirty &&
|
|
|
|
test "$(cat file)" = "modified again"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'pull --rebase --autostash & rebase.autoStash=false' '
|
|
|
|
test_config rebase.autostash false &&
|
|
|
|
git reset --hard before-rebase &&
|
|
|
|
echo dirty >new_file &&
|
|
|
|
git add new_file &&
|
|
|
|
git pull --rebase --autostash . copy &&
|
|
|
|
test_cmp_rev HEAD^ copy &&
|
|
|
|
test "$(cat new_file)" = dirty &&
|
|
|
|
test "$(cat file)" = "modified again"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'pull --rebase: --autostash & rebase.autoStash unset' '
|
|
|
|
git reset --hard before-rebase &&
|
|
|
|
echo dirty >new_file &&
|
|
|
|
git add new_file &&
|
|
|
|
git pull --rebase --autostash . copy &&
|
|
|
|
test_cmp_rev HEAD^ copy &&
|
|
|
|
test "$(cat new_file)" = dirty &&
|
|
|
|
test "$(cat file)" = "modified again"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'pull --rebase --no-autostash & rebase.autostash=true' '
|
|
|
|
test_config rebase.autostash true &&
|
|
|
|
git reset --hard before-rebase &&
|
|
|
|
echo dirty >new_file &&
|
|
|
|
git add new_file &&
|
|
|
|
test_must_fail git pull --rebase --no-autostash . copy 2>err &&
|
|
|
|
test_i18ngrep "Cannot pull with rebase: Your index contains uncommitted changes." err
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'pull --rebase --no-autostash & rebase.autostash=false' '
|
|
|
|
test_config rebase.autostash false &&
|
|
|
|
git reset --hard before-rebase &&
|
|
|
|
echo dirty >new_file &&
|
|
|
|
git add new_file &&
|
|
|
|
test_must_fail git pull --rebase --no-autostash . copy 2>err &&
|
|
|
|
test_i18ngrep "Cannot pull with rebase: Your index contains uncommitted changes." err
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'pull --rebase --no-autostash & rebase.autostash unset' '
|
|
|
|
git reset --hard before-rebase &&
|
|
|
|
echo dirty >new_file &&
|
|
|
|
git add new_file &&
|
|
|
|
test_must_fail git pull --rebase --no-autostash . copy 2>err &&
|
|
|
|
test_i18ngrep "Cannot pull with rebase: Your index contains uncommitted changes." err
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'pull --autostash (without --rebase) should error out' '
|
|
|
|
test_must_fail git pull --autostash . copy 2>actual &&
|
|
|
|
echo "fatal: --[no-]autostash option is only valid with --rebase." >expect &&
|
|
|
|
test_i18ncmp actual expect
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'pull --no-autostash (without --rebase) should error out' '
|
|
|
|
test_must_fail git pull --no-autostash . copy 2>actual &&
|
|
|
|
echo "fatal: --[no-]autostash option is only valid with --rebase." >expect &&
|
|
|
|
test_i18ncmp actual expect
|
|
|
|
'
|
|
|
|
|
2011-11-06 13:50:10 +04:00
|
|
|
test_expect_success 'pull.rebase' '
|
|
|
|
git reset --hard before-rebase &&
|
2013-03-25 01:06:07 +04:00
|
|
|
test_config pull.rebase true &&
|
2011-11-06 13:50:10 +04:00
|
|
|
git pull . copy &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
|
|
|
|
test new = "$(git show HEAD:file2)"
|
2011-11-06 13:50:10 +04:00
|
|
|
'
|
2007-11-28 16:11:07 +03:00
|
|
|
|
|
|
|
test_expect_success 'branch.to-rebase.rebase' '
|
|
|
|
git reset --hard before-rebase &&
|
2013-03-25 01:06:07 +04:00
|
|
|
test_config branch.to-rebase.rebase true &&
|
2007-11-28 16:11:07 +03:00
|
|
|
git pull . copy &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
|
|
|
|
test new = "$(git show HEAD:file2)"
|
2007-11-28 16:11:07 +03:00
|
|
|
'
|
|
|
|
|
2011-11-06 13:50:10 +04:00
|
|
|
test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '
|
|
|
|
git reset --hard before-rebase &&
|
2013-03-25 01:06:07 +04:00
|
|
|
test_config pull.rebase true &&
|
|
|
|
test_config branch.to-rebase.rebase false &&
|
2011-11-06 13:50:10 +04:00
|
|
|
git pull . copy &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$(git rev-parse HEAD^)" != "$(git rev-parse copy)" &&
|
|
|
|
test new = "$(git show HEAD:file2)"
|
2011-11-06 13:50:10 +04:00
|
|
|
'
|
|
|
|
|
2013-08-13 07:43:42 +04:00
|
|
|
# add a feature branch, keep-merge, that is merged into master, so the
|
|
|
|
# test can try preserving the merge commit (or not) with various
|
|
|
|
# --rebase flags/pull.rebase settings.
|
|
|
|
test_expect_success 'preserve merge setup' '
|
|
|
|
git reset --hard before-rebase &&
|
|
|
|
git checkout -b keep-merge second^ &&
|
|
|
|
test_commit file3 &&
|
|
|
|
git checkout to-rebase &&
|
|
|
|
git merge keep-merge &&
|
|
|
|
git tag before-preserve-rebase
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'pull.rebase=false create a new merge commit' '
|
|
|
|
git reset --hard before-preserve-rebase &&
|
|
|
|
test_config pull.rebase false &&
|
|
|
|
git pull . copy &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$(git rev-parse HEAD^1)" = "$(git rev-parse before-preserve-rebase)" &&
|
|
|
|
test "$(git rev-parse HEAD^2)" = "$(git rev-parse copy)" &&
|
|
|
|
test file3 = "$(git show HEAD:file3.t)"
|
2013-08-13 07:43:42 +04:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'pull.rebase=true flattens keep-merge' '
|
|
|
|
git reset --hard before-preserve-rebase &&
|
|
|
|
test_config pull.rebase true &&
|
|
|
|
git pull . copy &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
|
|
|
|
test file3 = "$(git show HEAD:file3.t)"
|
2013-08-13 07:43:42 +04:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '
|
|
|
|
git reset --hard before-preserve-rebase &&
|
|
|
|
test_config pull.rebase 1 &&
|
|
|
|
git pull . copy &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
|
|
|
|
test file3 = "$(git show HEAD:file3.t)"
|
2013-08-13 07:43:42 +04:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'pull.rebase=preserve rebases and merges keep-merge' '
|
|
|
|
git reset --hard before-preserve-rebase &&
|
|
|
|
test_config pull.rebase preserve &&
|
|
|
|
git pull . copy &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
|
|
|
|
test "$(git rev-parse HEAD^2)" = "$(git rev-parse keep-merge)"
|
2013-08-13 07:43:42 +04:00
|
|
|
'
|
|
|
|
|
2016-01-13 15:17:15 +03:00
|
|
|
test_expect_success 'pull.rebase=interactive' '
|
|
|
|
write_script "$TRASH_DIRECTORY/fake-editor" <<-\EOF &&
|
|
|
|
echo I was here >fake.out &&
|
|
|
|
false
|
|
|
|
EOF
|
|
|
|
test_set_editor "$TRASH_DIRECTORY/fake-editor" &&
|
|
|
|
test_must_fail git pull --rebase=interactive . copy &&
|
|
|
|
test "I was here" = "$(cat fake.out)"
|
|
|
|
'
|
|
|
|
|
2013-08-13 07:43:42 +04:00
|
|
|
test_expect_success 'pull.rebase=invalid fails' '
|
|
|
|
git reset --hard before-preserve-rebase &&
|
|
|
|
test_config pull.rebase invalid &&
|
|
|
|
! git pull . copy
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success '--rebase=false create a new merge commit' '
|
|
|
|
git reset --hard before-preserve-rebase &&
|
|
|
|
test_config pull.rebase true &&
|
|
|
|
git pull --rebase=false . copy &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$(git rev-parse HEAD^1)" = "$(git rev-parse before-preserve-rebase)" &&
|
|
|
|
test "$(git rev-parse HEAD^2)" = "$(git rev-parse copy)" &&
|
|
|
|
test file3 = "$(git show HEAD:file3.t)"
|
2013-08-13 07:43:42 +04:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success '--rebase=true rebases and flattens keep-merge' '
|
|
|
|
git reset --hard before-preserve-rebase &&
|
|
|
|
test_config pull.rebase preserve &&
|
|
|
|
git pull --rebase=true . copy &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
|
|
|
|
test file3 = "$(git show HEAD:file3.t)"
|
2013-08-13 07:43:42 +04:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success '--rebase=preserve rebases and merges keep-merge' '
|
|
|
|
git reset --hard before-preserve-rebase &&
|
|
|
|
test_config pull.rebase true &&
|
|
|
|
git pull --rebase=preserve . copy &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
|
|
|
|
test "$(git rev-parse HEAD^2)" = "$(git rev-parse keep-merge)"
|
2013-08-13 07:43:42 +04:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success '--rebase=invalid fails' '
|
|
|
|
git reset --hard before-preserve-rebase &&
|
|
|
|
! git pull --rebase=invalid . copy
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-merge' '
|
|
|
|
git reset --hard before-preserve-rebase &&
|
|
|
|
test_config pull.rebase preserve &&
|
|
|
|
git pull --rebase . copy &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
|
|
|
|
test file3 = "$(git show HEAD:file3.t)"
|
2013-08-13 07:43:42 +04:00
|
|
|
'
|
|
|
|
|
2008-01-26 21:04:37 +03:00
|
|
|
test_expect_success '--rebase with rebased upstream' '
|
|
|
|
|
|
|
|
git remote add -f me . &&
|
|
|
|
git checkout copy &&
|
2009-06-12 02:39:19 +04:00
|
|
|
git tag copy-orig &&
|
2008-01-26 21:04:37 +03:00
|
|
|
git reset --hard HEAD^ &&
|
|
|
|
echo conflicting modification > file &&
|
|
|
|
git commit -m conflict file &&
|
|
|
|
git checkout to-rebase &&
|
|
|
|
echo file > file2 &&
|
|
|
|
git commit -m to-rebase file2 &&
|
2009-06-12 02:39:19 +04:00
|
|
|
git tag to-rebase-orig &&
|
2008-01-26 21:04:37 +03:00
|
|
|
git pull --rebase me copy &&
|
|
|
|
test "conflicting modification" = "$(cat file)" &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test file = "$(cat file2)"
|
2008-01-26 21:04:37 +03:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2015-06-02 17:22:52 +03:00
|
|
|
test_expect_success '--rebase -f with rebased upstream' '
|
|
|
|
test_when_finished "test_might_fail git rebase --abort" &&
|
|
|
|
git reset --hard to-rebase-orig &&
|
|
|
|
git pull --rebase -f me copy &&
|
|
|
|
test "conflicting modification" = "$(cat file)" &&
|
|
|
|
test file = "$(cat file2)"
|
|
|
|
'
|
|
|
|
|
2009-06-12 02:39:19 +04:00
|
|
|
test_expect_success '--rebase with rebased default upstream' '
|
|
|
|
|
|
|
|
git update-ref refs/remotes/me/copy copy-orig &&
|
|
|
|
git checkout --track -b to-rebase2 me/copy &&
|
|
|
|
git reset --hard to-rebase-orig &&
|
|
|
|
git pull --rebase &&
|
|
|
|
test "conflicting modification" = "$(cat file)" &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test file = "$(cat file2)"
|
2009-06-12 02:39:19 +04:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2009-07-19 11:45:16 +04:00
|
|
|
test_expect_success 'rebased upstream + fetch + pull --rebase' '
|
2009-07-16 04:09:14 +04:00
|
|
|
|
|
|
|
git update-ref refs/remotes/me/copy copy-orig &&
|
|
|
|
git reset --hard to-rebase-orig &&
|
|
|
|
git checkout --track -b to-rebase3 me/copy &&
|
|
|
|
git reset --hard to-rebase-orig &&
|
|
|
|
git fetch &&
|
2009-07-19 11:45:16 +04:00
|
|
|
git pull --rebase &&
|
2009-07-16 04:09:14 +04:00
|
|
|
test "conflicting modification" = "$(cat file)" &&
|
|
|
|
test file = "$(cat file2)"
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2008-05-21 15:32:16 +04:00
|
|
|
test_expect_success 'pull --rebase dies early with dirty working directory' '
|
|
|
|
|
2009-06-12 02:39:19 +04:00
|
|
|
git checkout to-rebase &&
|
2008-05-21 15:32:16 +04:00
|
|
|
git update-ref refs/remotes/me/copy copy^ &&
|
2015-05-18 16:32:51 +03:00
|
|
|
COPY="$(git rev-parse --verify me/copy)" &&
|
2008-05-21 15:32:16 +04:00
|
|
|
git rebase --onto $COPY copy &&
|
2013-03-28 16:40:19 +04:00
|
|
|
test_config branch.to-rebase.remote me &&
|
|
|
|
test_config branch.to-rebase.merge refs/heads/copy &&
|
|
|
|
test_config branch.to-rebase.rebase true &&
|
2008-05-21 15:32:16 +04:00
|
|
|
echo dirty >> file &&
|
|
|
|
git add file &&
|
|
|
|
test_must_fail git pull &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$COPY" = "$(git rev-parse --verify me/copy)" &&
|
2008-05-21 15:32:16 +04:00
|
|
|
git checkout HEAD -- file &&
|
|
|
|
git pull &&
|
2015-05-18 16:32:51 +03:00
|
|
|
test "$COPY" != "$(git rev-parse --verify me/copy)"
|
2008-05-21 15:32:16 +04:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2009-08-12 07:27:40 +04:00
|
|
|
test_expect_success 'pull --rebase works on branch yet to be born' '
|
|
|
|
git rev-parse master >expect &&
|
|
|
|
mkdir empty_repo &&
|
|
|
|
(cd empty_repo &&
|
|
|
|
git init &&
|
|
|
|
git pull --rebase .. master &&
|
|
|
|
git rev-parse HEAD >../actual
|
|
|
|
) &&
|
|
|
|
test_cmp expect actual
|
|
|
|
'
|
|
|
|
|
2015-05-29 14:44:43 +03:00
|
|
|
test_expect_success 'pull --rebase fails on unborn branch with staged changes' '
|
|
|
|
test_when_finished "rm -rf empty_repo2" &&
|
|
|
|
git init empty_repo2 &&
|
|
|
|
(
|
|
|
|
cd empty_repo2 &&
|
|
|
|
echo staged-file >staged-file &&
|
|
|
|
git add staged-file &&
|
|
|
|
test "$(git ls-files)" = staged-file &&
|
|
|
|
test_must_fail git pull --rebase .. master 2>err &&
|
|
|
|
test "$(git ls-files)" = staged-file &&
|
|
|
|
test "$(git show :staged-file)" = staged-file &&
|
|
|
|
test_i18ngrep "unborn branch with changes added to the index" err
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
2010-08-13 05:50:49 +04:00
|
|
|
test_expect_success 'setup for detecting upstreamed changes' '
|
|
|
|
mkdir src &&
|
|
|
|
(cd src &&
|
|
|
|
git init &&
|
|
|
|
printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" > stuff &&
|
|
|
|
git add stuff &&
|
|
|
|
git commit -m "Initial revision"
|
|
|
|
) &&
|
|
|
|
git clone src dst &&
|
|
|
|
(cd src &&
|
|
|
|
modify s/5/43/ stuff &&
|
|
|
|
git commit -a -m "5->43" &&
|
|
|
|
modify s/6/42/ stuff &&
|
|
|
|
git commit -a -m "Make it bigger"
|
|
|
|
) &&
|
|
|
|
(cd dst &&
|
|
|
|
modify s/5/43/ stuff &&
|
|
|
|
git commit -a -m "Independent discovery of 5->43"
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
pull --rebase: Avoid spurious conflicts and reapplying unnecessary patches
Prior to c85c792 (pull --rebase: be cleverer with rebased upstream
branches, 2008-01-26), pull --rebase would run
git rebase $merge_head
which resulted in a call to
git format-patch ... --ignore-if-in-upstream $merge_head..$cur_branch
This resulted in patches from $merge_head..$cur_branch being applied, as
long as they did not already exist in $cur_branch..$merge_head.
Unfortunately, when upstream is rebased, $merge_head..$cur_branch also
refers to "old" commits that have already been rebased upstream, meaning
that many patches that were already fixed upstream would be reapplied.
This could result in many spurious conflicts, as well as reintroduce
patches that were intentionally dropped upstream.
So the algorithm was changed in c85c792 (pull --rebase: be cleverer with
rebased upstream branches, 2008-01-26) and d44e712 (pull: support rebased
upstream + fetch + pull --rebase, 2009-07-19). Defining $old_remote_ref to
be the most recent entry in the reflog for @{upstream} that is an ancestor
of $cur_branch, pull --rebase was changed to run
git rebase --onto $merge_head $old_remote_ref
which results in a call to
git format-patch ... --ignore-if-in-upstream $old_remote_ref..$cur_branch
The whole point of this change was to reduce the number of commits being
reapplied, by avoiding commits that upstream already has or had.
In the rebased upstream case, this change achieved that purpose. It is
worth noting, though, that since $old_remote_ref is always an ancestor of
$cur_branch (by its definition), format-patch will not know what upstream
is and thus will not be able to determine if any patches are already
upstream; they will all be reapplied.
In the non-rebased upstream case, this new form is usually the same as the
original code but in some cases $old_remote_ref can be an ancestor of
$(git merge-base $merge_head $cur_branch)
meaning that instead of avoiding reapplying commits that upstream already
has, it actually includes more such commits. Combined with the fact that
format-patch can no longer detect commits that are already upstream (since
it is no longer told what upstream is), results in lots of confusion for
users (e.g. "git is giving me lots of conflicts in stuff I didn't even
change since my last push.")
Cases where additional commits could be reapplied include forking from a
commit other than the tracking branch, or amending/rebasing after pushing.
Cases where the inability to detect upstreamed commits cause problems
include independent discovery of a fix and having your patches get
upstreamed by some alternative route (e.g. pulling your changes to a third
machine, pushing from there, and then going back to your original machine
and trying to pull --rebase).
Fix the non-rebased upstream case by ignoring $old_remote_ref whenever it
is contained in $(git merge-base $merge_head $cur_branch). This should
have no affect on the rebased upstream case.
Acked-by: Santi Béjar <santi@agolina.net>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-13 05:50:50 +04:00
|
|
|
test_expect_success 'git pull --rebase detects upstreamed changes' '
|
2010-08-13 05:50:49 +04:00
|
|
|
(cd dst &&
|
|
|
|
git pull --rebase &&
|
|
|
|
test -z "$(git ls-files -u)"
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'setup for avoiding reapplying old patches' '
|
|
|
|
(cd dst &&
|
|
|
|
test_might_fail git rebase --abort &&
|
|
|
|
git reset --hard origin/master
|
|
|
|
) &&
|
|
|
|
git clone --bare src src-replace.git &&
|
|
|
|
rm -rf src &&
|
|
|
|
mv src-replace.git src &&
|
|
|
|
(cd dst &&
|
|
|
|
modify s/2/22/ stuff &&
|
|
|
|
git commit -a -m "Change 2" &&
|
|
|
|
modify s/3/33/ stuff &&
|
|
|
|
git commit -a -m "Change 3" &&
|
|
|
|
modify s/4/44/ stuff &&
|
|
|
|
git commit -a -m "Change 4" &&
|
|
|
|
git push &&
|
|
|
|
|
|
|
|
modify s/44/55/ stuff &&
|
|
|
|
git commit --amend -a -m "Modified Change 4"
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
pull --rebase: Avoid spurious conflicts and reapplying unnecessary patches
Prior to c85c792 (pull --rebase: be cleverer with rebased upstream
branches, 2008-01-26), pull --rebase would run
git rebase $merge_head
which resulted in a call to
git format-patch ... --ignore-if-in-upstream $merge_head..$cur_branch
This resulted in patches from $merge_head..$cur_branch being applied, as
long as they did not already exist in $cur_branch..$merge_head.
Unfortunately, when upstream is rebased, $merge_head..$cur_branch also
refers to "old" commits that have already been rebased upstream, meaning
that many patches that were already fixed upstream would be reapplied.
This could result in many spurious conflicts, as well as reintroduce
patches that were intentionally dropped upstream.
So the algorithm was changed in c85c792 (pull --rebase: be cleverer with
rebased upstream branches, 2008-01-26) and d44e712 (pull: support rebased
upstream + fetch + pull --rebase, 2009-07-19). Defining $old_remote_ref to
be the most recent entry in the reflog for @{upstream} that is an ancestor
of $cur_branch, pull --rebase was changed to run
git rebase --onto $merge_head $old_remote_ref
which results in a call to
git format-patch ... --ignore-if-in-upstream $old_remote_ref..$cur_branch
The whole point of this change was to reduce the number of commits being
reapplied, by avoiding commits that upstream already has or had.
In the rebased upstream case, this change achieved that purpose. It is
worth noting, though, that since $old_remote_ref is always an ancestor of
$cur_branch (by its definition), format-patch will not know what upstream
is and thus will not be able to determine if any patches are already
upstream; they will all be reapplied.
In the non-rebased upstream case, this new form is usually the same as the
original code but in some cases $old_remote_ref can be an ancestor of
$(git merge-base $merge_head $cur_branch)
meaning that instead of avoiding reapplying commits that upstream already
has, it actually includes more such commits. Combined with the fact that
format-patch can no longer detect commits that are already upstream (since
it is no longer told what upstream is), results in lots of confusion for
users (e.g. "git is giving me lots of conflicts in stuff I didn't even
change since my last push.")
Cases where additional commits could be reapplied include forking from a
commit other than the tracking branch, or amending/rebasing after pushing.
Cases where the inability to detect upstreamed commits cause problems
include independent discovery of a fix and having your patches get
upstreamed by some alternative route (e.g. pulling your changes to a third
machine, pushing from there, and then going back to your original machine
and trying to pull --rebase).
Fix the non-rebased upstream case by ignoring $old_remote_ref whenever it
is contained in $(git merge-base $merge_head $cur_branch). This should
have no affect on the rebased upstream case.
Acked-by: Santi Béjar <santi@agolina.net>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-13 05:50:50 +04:00
|
|
|
test_expect_success 'git pull --rebase does not reapply old patches' '
|
2010-08-13 05:50:49 +04:00
|
|
|
(cd dst &&
|
|
|
|
test_must_fail git pull --rebase &&
|
|
|
|
test 1 = $(find .git/rebase-apply -name "000*" | wc -l)
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
2010-11-14 01:58:22 +03:00
|
|
|
test_expect_success 'git pull --rebase against local branch' '
|
|
|
|
git checkout -b copy2 to-rebase-orig &&
|
|
|
|
git pull --rebase . to-rebase &&
|
|
|
|
test "conflicting modification" = "$(cat file)" &&
|
|
|
|
test file = "$(cat file2)"
|
|
|
|
'
|
|
|
|
|
2006-11-16 22:47:22 +03:00
|
|
|
test_done
|