Skip to content

Commit 6106ce4

Browse files
drafnelgitster
authored andcommitted
t/t5510: demonstrate failure to fetch when current branch has merge ref
When 'git fetch' is supplied just a repository URL (not a remote name), and without a fetch refspec, it should fetch from the remote HEAD branch and update FETCH_HEAD with the fetched ref. Currently, when 'git fetch' is called like this, it fails to retrieve anything, and does not update FETCH_HEAD, if the current checked-out branch has a configured merge ref. i.e. this fetch fails to retrieve anything nor update FETCH_HEAD: git checkout master git config branch.master.merge refs/heads/master git fetch git://git.kernel.org/pub/scm/git/git.git but this one does: git config --unset branch.master.merge git fetch git://git.kernel.org/pub/scm/git/git.git Add a test to demonstrate this flaw. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent d599e04 commit 6106ce4

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

t/t5510-fetch.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ test_expect_success 'fetch with a non-applying branch.<name>.merge' '
240240
git fetch blub
241241
'
242242

243+
test_expect_failure 'fetch from GIT URL with a non-applying branch.<name>.merge' '
244+
git update-ref -d FETCH_HEAD &&
245+
git fetch one &&
246+
git rev-parse --verify FETCH_HEAD
247+
'
248+
243249
# the strange name is: a\!'b
244250
test_expect_success 'quoting of a strangely named repo' '
245251
test_must_fail git fetch "a\\!'\''b" > result 2>&1 &&

0 commit comments

Comments
 (0)