author | Junio C Hamano <gitster@pobox.com> | |
Fri, 8 Jun 2007 08:19:13 +0000 (01:19 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 8 Jun 2007 08:19:13 +0000 (01:19 -0700) | ||
commit | 5035242c4785bd23c53827a1656b5f97394f724e | |
tree | f7ea750c986e73b3d1eff27070e547f8d5373857 | tree | snapshot |
parent | 23fcdc79713c47a6a0d50762b9311c9933a60d3f | commit | diff |
checkout: do not get confused with ambiguous tag/branch names
Although it is not advisable, we have always allowed a branch
and a tag to have the same basename (i.e. it is not illegal to
have refs/heads/frotz and refs/tags/frotz at the same time).
When talking about a specific commit, the interpretation of
'frotz' has always been "use tag and then check branch",
although we warn when ambiguities exist.
However "git checkout $name" is defined to (1) first see if it
matches the branch name, and if so switch to that branch; (2)
otherwise it is an instruction to detach HEAD to point at the
commit named by $name. We did not follow this definition when
$name appeared under both refs/heads/ and refs/tags/ -- we
switched to the branch but read the tree from the tagged commit,
which was utterly bogus.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Although it is not advisable, we have always allowed a branch
and a tag to have the same basename (i.e. it is not illegal to
have refs/heads/frotz and refs/tags/frotz at the same time).
When talking about a specific commit, the interpretation of
'frotz' has always been "use tag and then check branch",
although we warn when ambiguities exist.
However "git checkout $name" is defined to (1) first see if it
matches the branch name, and if so switch to that branch; (2)
otherwise it is an instruction to detach HEAD to point at the
commit named by $name. We did not follow this definition when
$name appeared under both refs/heads/ and refs/tags/ -- we
switched to the branch but read the tree from the tagged commit,
which was utterly bogus.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-checkout.sh | diff | blob | history | |
t/t7201-co.sh | diff | blob | history |