[pkg-go] Bug#811565: [uscan] git mode: allow for scanning repositories without tags

Martín Ferrari tincho at tincho.org
Sun Jul 30 14:23:35 UTC 2017


On 29/07/17 17:44, Michael Stapelberg wrote:


> Given that we are talking about repositories which do not use tags, we
> could specify --depth=1 when cloning to get a shallow clone, i.e. only
> the latest commit. That saves bandwidth and disk space, but has the
> downside that we cannot do any additional validation, i.e. we can’t
> detect if upstream ever starts using tags — unfortunately, that is a
> plausible scenario, so I would suggest doing a full clone.

As a data point, I wrote a script a while ago to do exactly this
locally. I used the shallow clone on a temporary directory:

backticks("git", "clone", "--quiet", "--bare", "--depth=1", $url,
    $dest);

my $commit_data = backticks("git", "--git-dir=$dest", "log", "-1",
    "--date=format:%Y%m%d", "--format=%h %cd");

chomp($commit_data);
$commit_data =~ /^([0-9a-z]{7}) ([0-9]{8})$/m
    or die("Invalid git response: $commit_data");
return ($1, $2);

-- 
Martín Ferrari (Tincho)



More information about the Pkg-go-maintainers mailing list