{"thread":{"id":"51443","subject":"`git describe` skipping shallow fetched (grafted) tag","startedAt":"2019-07-08T05:03:15Z","lastAt":"2019-07-08T05:03:15Z","messageCount":1,"participants":["Anthony Sottile"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"378671","messageId":"CA+dzEBmmSmPWvK6ZKNiyH18V+HdTd+XMtq9TsSsDHorNThtGcA@mail.gmail.com","threadId":"51443","inReplyTo":null,"subject":"`git describe` skipping shallow fetched (grafted) tag","fromName":"Anthony Sottile","fromEmail":"asottile@umich.edu","sentAt":"2019-07-08T05:03:01Z","receivedAt":"2019-07-08T05:03:15Z","isPatch":false,"sender":{"key":"asottile@umich.edu","avatar":"https://avatars.githubusercontent.com/u/1810591?v=4"},"body":"I haven't been able to boil this down to a minimal reproduction yet\nbut here's my current reproduction -- I'm very confused by the output\nI've gathered so far:\n\n```\nrm -rf repo1\ngit init repo1\ncd repo1\ngit remote add origin https://github.com/asottile/pyupgrade\ngit -c protocol.version=2 fetch origin v1.20.1 --depth=1\ngit fetch\ngit describe origin/master --debug --tags\n```\n\n```\n+ git --version\ngit version 2.20.1 (Apple Git-117)\n+ rm -rf repo1\n+ git init repo1\nInitialized empty Git repository in /private/tmp/x/repo1/.git/\n+ cd repo1\n+ git remote add origin https://github.com/asottile/pyupgrade\n+ git -c protocol.version=2 fetch origin v1.20.1 --depth=1\nremote: Enumerating objects: 38, done.\nremote: Counting objects: 100% (38/38), done.\nremote: Compressing objects: 100% (32/32), done.\nremote: Total 38 (delta 4), reused 27 (delta 3), pack-reused 0\nUnpacking objects: 100% (38/38), done.\nFrom https://github.com/asottile/pyupgrade\n * tag               v1.20.1    -> FETCH_HEAD\n+ git fetch\nremote: Enumerating objects: 1195, done.\nremote: Counting objects: 100% (1195/1195), done.\nremote: Compressing objects: 100% (436/436), done.\nremote: Total 1195 (delta 753), reused 1188 (delta 748), pack-reused 0\nReceiving objects: 100% (1195/1195), 290.55 KiB | 3.09 MiB/s, done.\nResolving deltas: 100% (753/753), done.\nFrom https://github.com/asottile/pyupgrade\n * [new branch]      binary_literals -> origin/binary_literals\n * [new branch]      master          -> origin/master\n * [new tag]         v1.20.1         -> v1.20.1\n * [new tag]         v0.0.0          -> v0.0.0\n * [new tag]         v1.0.0          -> v1.0.0\n * [new tag]         v1.0.1          -> v1.0.1\n * [new tag]         v1.0.2          -> v1.0.2\n * [new tag]         v1.0.3          -> v1.0.3\n * [new tag]         v1.0.4          -> v1.0.4\n * [new tag]         v1.0.5          -> v1.0.5\n * [new tag]         v1.0.6          -> v1.0.6\n * [new tag]         v1.1.0          -> v1.1.0\n * [new tag]         v1.1.1          -> v1.1.1\n * [new tag]         v1.1.2          -> v1.1.2\n * [new tag]         v1.1.2-1        -> v1.1.2-1\n * [new tag]         v1.1.3          -> v1.1.3\n * [new tag]         v1.1.4          -> v1.1.4\n * [new tag]         v1.10.0         -> v1.10.0\n * [new tag]         v1.10.1         -> v1.10.1\n * [new tag]         v1.11.0         -> v1.11.0\n * [new tag]         v1.11.1         -> v1.11.1\n * [new tag]         v1.11.2         -> v1.11.2\n * [new tag]         v1.11.3         -> v1.11.3\n * [new tag]         v1.12.0         -> v1.12.0\n * [new tag]         v1.13.0         -> v1.13.0\n * [new tag]         v1.14.0         -> v1.14.0\n * [new tag]         v1.15.0         -> v1.15.0\n * [new tag]         v1.16.0         -> v1.16.0\n * [new tag]         v1.16.1         -> v1.16.1\n * [new tag]         v1.16.2         -> v1.16.2\n * [new tag]         v1.16.3         -> v1.16.3\n * [new tag]         v1.17.0         -> v1.17.0\n * [new tag]         v1.17.1         -> v1.17.1\n * [new tag]         v1.18.0         -> v1.18.0\n * [new tag]         v1.19.0         -> v1.19.0\n * [new tag]         v1.2.0          -> v1.2.0\n * [new tag]         v1.20.0         -> v1.20.0\n * [new tag]         v1.3.0          -> v1.3.0\n * [new tag]         v1.3.1          -> v1.3.1\n * [new tag]         v1.4.0          -> v1.4.0\n * [new tag]         v1.5.0          -> v1.5.0\n * [new tag]         v1.5.1          -> v1.5.1\n * [new tag]         v1.6.0          -> v1.6.0\n * [new tag]         v1.6.1          -> v1.6.1\n * [new tag]         v1.7.0          -> v1.7.0\n * [new tag]         v1.8.0          -> v1.8.0\n * [new tag]         v1.9.0          -> v1.9.0\n * [new tag]         v1.9.1          -> v1.9.1\n+ git describe origin/master --debug --tags --abbrev=0\ndescribe origin/master\nNo exact match on refs or tags, searching to describe\n lightweight        6 v1.20.0\n lightweight       26 v1.19.0\n lightweight       41 v1.18.0\n lightweight       63 v1.17.1\n lightweight       68 v1.17.0\n lightweight       76 v1.16.3\n lightweight       79 v1.16.2\n lightweight       82 v1.16.1\n lightweight       87 v1.16.0\n lightweight       99 v1.20.1\ntraversed 101 commits\nmore than 10 tags found; listed 10 most recent\ngave up search at eff26acd6261727e049449e2aa481db4c8146d21\nv1.20.0\n```\n\nIf I inspect the history using `git log` inside of `repo1`:\n\n```\n$ git log origin/master --decorate --oneline | head -10\n3c13b24 (origin/master) Merge pull request #184 from mxr/typing-bugs\na5bfb80 Fix type annotation\n91815ae Merge pull request #183 from asottile/parenthesized_format\n38f1bcb (grafted, tag: v1.20.1) v1.20.1\n559bc04 Utilize rfind_string_parts to improve .format() rewrite\n72575fe simplify _get_body test\nc93c34e (tag: v1.20.0) v1.20.0\n9bc6390 Merge pull request #181 from asottile/numeric_fixes_in_py3\n6df0901 Also fix octal / long literals in python 3\n14a7c6a Merge pull request #180 from asottile/stdin\n```\n\nI see the `grafted` tag appear sooner in the history than the\nnon-grafted tag, but `git describe` doesn't find it.\n\nreal-world issue: https://github.com/pre-commit/pre-commit/issues/1076\n\nAnthony\n"}]}