From 26ff3b7bfb2d3a66e57c71ef3aa2e296fcfb1bd4 Mon Sep 17 00:00:00 2001 From: Remy Suen Date: Sat, 11 Mar 2017 18:27:38 +0900 Subject: [PATCH] `Repository.checkoutBranch` does nothing if branch name matches tag name Add a failing test wherein the existence of both a refs/heads/branch branch reference and a refs/tags/branch tag reference will cause the checkout to fail. --- test/tests/checkout.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/tests/checkout.js b/test/tests/checkout.js index e3815a35f..013681af6 100644 --- a/test/tests/checkout.js +++ b/test/tests/checkout.js @@ -108,6 +108,29 @@ describe("Checkout", function() { }); }); + it("can checkout a branch with a name that conflicts with a tag", function() { + var test = this; + var commit; + + return test.repository.getHeadCommit() + .then(function(headCommit) { + commit = headCommit; + return test.repository.createLightweightTag(commit.sha(), "conflict"); + }) + .then(function() { + return test.repository.createBranch("conflict", commit); + }) + .then(function() { + return test.repository.checkoutBranch("conflict"); + }) + .then(function() { + return test.repository.head(); + }) + .then(function(ref) { + assert.equal(ref.name(), "refs/heads/conflict"); + }); + }); + it("can checkout an index with conflicts", function() { var test = this;