Describe the bug
A common idea is to poing revision and targetRevision in Application and ApplicationSet to HEAD, which usually is a ref to the tip of your main branch (usually master). the resolution of names to refspecs happens at the client, so HEAD is a special case that gets translated to this other refspec.
The problem arises when someone pushes an actual branch named HEAD, clients still respect following the redirection, argo actually pulls the branch instead, which causes quite the confusion as you see unexpected commits being pulled.
To Reproduce
Have applications pointing to HEAD.
Create a branch with older commits or recognizable commits
git push origin refs/heads/HEAD (creates a remote branch called HEAD)
Observe ArgoCD behavior, commits being pulled HEAD references in applications will be from this branch.
Expected behavior
Ideally i would expect it to follow the normal git cli/github behavior when doing standard calls which is to follow the HEAD redirect.
Screenshots
Github Web UI correctly sends you to the last commit on master when opening this url:
ArgoCD Web UI shows the commit it found at HEAD, which is different, and is the tip of the branch called HEAD in this case.
Checklist:
argocd version
.Describe the bug A common idea is to poing
revision
andtargetRevision
inApplication
andApplicationSet
toHEAD
, which usually is a ref to the tip of your main branch (usuallymaster
). the resolution of names to refspecs happens at the client, soHEAD
is a special case that gets translated to this other refspec.The problem arises when someone pushes an actual branch named
HEAD
, clients still respect following the redirection, argo actually pulls the branch instead, which causes quite the confusion as you see unexpected commits being pulled.To Reproduce Have applications pointing to
HEAD
.git push origin refs/heads/HEAD
(creates a remote branch called HEAD)HEAD
references in applications will be from this branch.Expected behavior Ideally i would expect it to follow the normal git cli/github behavior when doing standard calls which is to follow the
HEAD
redirect.I believe it might be caused by this rename when finding the string
HEAD
, but i'm not sure: https://github.com/argoproj/argo-cd/blob/78460c4b365bcb1f58514abac1b37482f7eb561d/util/git/client.go#L442-L446Screenshots Github Web UI correctly sends you to the last commit on master when opening this url: ArgoCD Web UI shows the commit it found at HEAD, which is different, and is the tip of the branch called
HEAD
in this case.Version v2.6.8