This won’t help you if you already `fetch`’d, but how about suggesting a git 
config that folks can apply locally that adds a fetch ref spec that excludes 
`archive/`?

> On 29. Oct 2020, at 10:56, Ilya Khlopotov <iil...@apache.org> wrote:
> 
> Hello,
> 
> As you've probably know, recently old branches were archived. I tried to 
> build a new release locally and was very surprised that it couldn't start. 
> After scratching my head for few hours I figured out the following.
> I used `git fetch` command without specifying specific branch. This caused 
> fetching of archived tags and created additional references:
> 
> ❯ find .git/refs/tags/archive/ | head
> .git/refs/tags/archive/
> .git/refs/tags/archive//shard-local-query
> .git/refs/tags/archive//fix-reverse-fold-options
> .git/refs/tags/archive//experiment-transient-stats
> .git/refs/tags/archive//revert-dedup-detection
> .git/refs/tags/archive//rebar3
> .git/refs/tags/archive//exunit
> .git/refs/tags/archive//random-seed-chttpd-pids
> .git/refs/tags/archive//developer-preview-2.0
> .git/refs/tags/archive//remsh-improvement-3.0.x
> 
> The presence of additional tags caused the `git describe --always --tags` to 
> return something unexpected.
> 
> ❯ git checkout main
> Already on 'main'
> Your branch is up to date with 'origin/main'.
> 
> ❯ git describe --always --tags
> archive/prototype/fdb-layer-get-doc-spans-580-gdfb27b48a
> 
> The `git describe --always --tags` command is used by rebar here 
> https://github.com/rebar/rebar/blob/b6d309417c502ca243f810e5313bea36951ef038/src/rebar_utils.erl#L652.
>  It is used for applications which have `{vsn, git}` in *.app.src file 
> https://github.com/apache/couchdb/blob/main/src/couch/src/couch.app.src#L15
> 
> The presence of '/' in the result of `git describe --always --tags` changed 
> the layout of files in rel/couchdb
> in such a way that `code:priv_dir(couch).` doesn't resolve correctly to 
> existing directory. This prevents couch from starting.
> 
> Possible workarounds I can think of
> - patch rebar to use `git describe --always --tags --exclude 'archive/*'` 
> instead of `git describe --always --tags`
> - run `git tag -d (git tag -l "archive/*")` from `make dist`
> - write rebar plugin which would handle `{vsn, git}` differently
> - use explicit versioning instead of relying on `{vsn, git}`
> 
> I don't think switching to rebar3 would fix the issue. Because it uses git 
> command which would be broken in a similar way:
> - rebar3 
> https://github.com/erlang/rebar3/blob/5dab01986786f2ffc4ea2b8d34a94177f6f40808/src/rebar_git_resource.erl#L357
> ```
> ❯ git describe --tags --abbrev=0
> archive/prototype/fdb-layer-get-doc-spans
> ```
> 
> To me patching rebar seems like the easiest solution.
> 
> Best regards,
> iilyak

Reply via email to