VCS: Fix weird tag creation
commit1de31211124b162014c2a37e34d06567b3c1d90c
authorRebecca Turner <rbt@sent.as>
Fri, 22 Nov 2024 00:13:09 +0000 (21 16:13 -0800)
committerMikolaj <281893+Mikolaj@users.noreply.github.com>
Thu, 5 Dec 2024 17:42:35 +0000 (5 17:42 +0000)
treee9e065122e5bb6e18d22dd0de7c4bc3627b122b7
parent91769ab183f467f352c786c73f566e09ebb73aa7
VCS: Fix weird tag creation

Creating a tag with an arbitrary user-supplied name can cause problems.
If we fetch, we can just use `FETCH_HEAD` as the ref name directly!

```
Running: git fetch origin d1dc91fd977bb4b28f0e01966fa08640a1283318
From /private/var/folders/z5/fclwwdms3r1gq4k4p3pkvvc00000gn/T/vcstest-90401/src
 * branch            d1dc91fd977bb4b28f0e01966fa08640a1283318 -> FETCH_HEAD

Running: git tag -f d1dc91fd977bb4b28f0e01966fa08640a1283318 FETCH_HEAD

Running: git reset --hard d1dc91fd977bb4b28f0e01966fa08640a1283318 --
warning: refname 'd1dc91fd977bb4b28f0e01966fa08640a1283318' is ambiguous.
Git normally never creates a ref that ends with 40 hex characters
because it will be ignored when you just specify 40-hex. These refs
may be created by mistake. For example,

  git switch -c $br $(git rev-parse ...)

where "$br" is somehow empty and a 40-hex ref is created. Please
examine these refs and maybe delete them. Turn this message off by
running "git config advice.objectNameWarning false"
```
cabal-install/src/Distribution/Client/VCS.hs