devrandom / gitian-builder

Build packages in a secure deterministic fashion inside a VM
https://gitian.org/
Other
401 stars 226 forks source link

Use ref name as tag name instead of the constant "tobuild" #244

Open devrandom opened 3 years ago

devrandom commented 3 years ago

@dongcarl @abitmore - here's yet another improvement to #238, naming the local tag the same as the ref that was requested on the command line. This play better with git describe --tags.

Review / test would be welcome.

Fixes #243.

abitmore commented 3 years ago

Thanks. I'll test and report back.

abitmore commented 3 years ago

Unfortunately this does not work when checking out a commit or a branch, since git describe --tags may return different result after added the new tag.

Ideally we should avoid adding tags. I'll take a look to see how to fix it.

GIT-DESCRIBE(1)                                                             Git Manual                                                             GIT-DESCRIBE(1)

NAME
       git-describe - Describe a commit using the most recent tag reachable from it

SYNOPSIS
       git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]
       git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]

DESCRIPTION
       The command finds the most recent tag that is reachable from a commit. 
If the tag points to the commit, then only the tag is shown. Otherwise, it suffixes
       the tag name with the number of additional commits on top of the tagged 
object and the abbreviated object name of the most recent commit.

       By default (without --all or --tags) git describe only shows annotated tags. 
For more information about creating annotated tags see the -a and -s options
       to git-tag(1).

...

       --tags
           Instead of using only the annotated tags, use any tag found in refs/tags 
namespace. This option enables matching a lightweight (non-annotated) tag.

...
abitmore commented 3 years ago

It turns out that

Apparently we can't have both. Perhaps a better approach is to define a new option, e.g. --fetch-all, so that everyone would be happier?

abitmore commented 3 years ago

See https://github.com/devrandom/gitian-builder/pull/245.