`git describe` skipping shallow fetched (grafted) tag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I haven't been able to boil this down to a minimal reproduction yet
but here's my current reproduction -- I'm very confused by the output
I've gathered so far:

```
rm -rf repo1
git init repo1
cd repo1
git remote add origin https://github.com/asottile/pyupgrade
git -c protocol.version=2 fetch origin v1.20.1 --depth=1
git fetch
git describe origin/master --debug --tags
```

```
+ git --version
git version 2.20.1 (Apple Git-117)
+ rm -rf repo1
+ git init repo1
Initialized empty Git repository in /private/tmp/x/repo1/.git/
+ cd repo1
+ git remote add origin https://github.com/asottile/pyupgrade
+ git -c protocol.version=2 fetch origin v1.20.1 --depth=1
remote: Enumerating objects: 38, done.
remote: Counting objects: 100% (38/38), done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 38 (delta 4), reused 27 (delta 3), pack-reused 0
Unpacking objects: 100% (38/38), done.
>From https://github.com/asottile/pyupgrade
 * tag               v1.20.1    -> FETCH_HEAD
+ git fetch
remote: Enumerating objects: 1195, done.
remote: Counting objects: 100% (1195/1195), done.
remote: Compressing objects: 100% (436/436), done.
remote: Total 1195 (delta 753), reused 1188 (delta 748), pack-reused 0
Receiving objects: 100% (1195/1195), 290.55 KiB | 3.09 MiB/s, done.
Resolving deltas: 100% (753/753), done.
>From https://github.com/asottile/pyupgrade
 * [new branch]      binary_literals -> origin/binary_literals
 * [new branch]      master          -> origin/master
 * [new tag]         v1.20.1         -> v1.20.1
 * [new tag]         v0.0.0          -> v0.0.0
 * [new tag]         v1.0.0          -> v1.0.0
 * [new tag]         v1.0.1          -> v1.0.1
 * [new tag]         v1.0.2          -> v1.0.2
 * [new tag]         v1.0.3          -> v1.0.3
 * [new tag]         v1.0.4          -> v1.0.4
 * [new tag]         v1.0.5          -> v1.0.5
 * [new tag]         v1.0.6          -> v1.0.6
 * [new tag]         v1.1.0          -> v1.1.0
 * [new tag]         v1.1.1          -> v1.1.1
 * [new tag]         v1.1.2          -> v1.1.2
 * [new tag]         v1.1.2-1        -> v1.1.2-1
 * [new tag]         v1.1.3          -> v1.1.3
 * [new tag]         v1.1.4          -> v1.1.4
 * [new tag]         v1.10.0         -> v1.10.0
 * [new tag]         v1.10.1         -> v1.10.1
 * [new tag]         v1.11.0         -> v1.11.0
 * [new tag]         v1.11.1         -> v1.11.1
 * [new tag]         v1.11.2         -> v1.11.2
 * [new tag]         v1.11.3         -> v1.11.3
 * [new tag]         v1.12.0         -> v1.12.0
 * [new tag]         v1.13.0         -> v1.13.0
 * [new tag]         v1.14.0         -> v1.14.0
 * [new tag]         v1.15.0         -> v1.15.0
 * [new tag]         v1.16.0         -> v1.16.0
 * [new tag]         v1.16.1         -> v1.16.1
 * [new tag]         v1.16.2         -> v1.16.2
 * [new tag]         v1.16.3         -> v1.16.3
 * [new tag]         v1.17.0         -> v1.17.0
 * [new tag]         v1.17.1         -> v1.17.1
 * [new tag]         v1.18.0         -> v1.18.0
 * [new tag]         v1.19.0         -> v1.19.0
 * [new tag]         v1.2.0          -> v1.2.0
 * [new tag]         v1.20.0         -> v1.20.0
 * [new tag]         v1.3.0          -> v1.3.0
 * [new tag]         v1.3.1          -> v1.3.1
 * [new tag]         v1.4.0          -> v1.4.0
 * [new tag]         v1.5.0          -> v1.5.0
 * [new tag]         v1.5.1          -> v1.5.1
 * [new tag]         v1.6.0          -> v1.6.0
 * [new tag]         v1.6.1          -> v1.6.1
 * [new tag]         v1.7.0          -> v1.7.0
 * [new tag]         v1.8.0          -> v1.8.0
 * [new tag]         v1.9.0          -> v1.9.0
 * [new tag]         v1.9.1          -> v1.9.1
+ git describe origin/master --debug --tags --abbrev=0
describe origin/master
No exact match on refs or tags, searching to describe
 lightweight        6 v1.20.0
 lightweight       26 v1.19.0
 lightweight       41 v1.18.0
 lightweight       63 v1.17.1
 lightweight       68 v1.17.0
 lightweight       76 v1.16.3
 lightweight       79 v1.16.2
 lightweight       82 v1.16.1
 lightweight       87 v1.16.0
 lightweight       99 v1.20.1
traversed 101 commits
more than 10 tags found; listed 10 most recent
gave up search at eff26acd6261727e049449e2aa481db4c8146d21
v1.20.0
```

If I inspect the history using `git log` inside of `repo1`:

```
$ git log origin/master --decorate --oneline | head -10
3c13b24 (origin/master) Merge pull request #184 from mxr/typing-bugs
a5bfb80 Fix type annotation
91815ae Merge pull request #183 from asottile/parenthesized_format
38f1bcb (grafted, tag: v1.20.1) v1.20.1
559bc04 Utilize rfind_string_parts to improve .format() rewrite
72575fe simplify _get_body test
c93c34e (tag: v1.20.0) v1.20.0
9bc6390 Merge pull request #181 from asottile/numeric_fixes_in_py3
6df0901 Also fix octal / long literals in python 3
14a7c6a Merge pull request #180 from asottile/stdin
```

I see the `grafted` tag appear sooner in the history than the
non-grafted tag, but `git describe` doesn't find it.

real-world issue: https://github.com/pre-commit/pre-commit/issues/1076

Anthony



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux