agent icon indicating copy to clipboard operation
agent copied to clipboard

Fetch git tags by default

Open lox opened this issue 3 years ago • 9 comments
trafficstars

Historically this wasn't added due to --tags not being supported in earlier git versions (#338), but that was 2016. By now it's well supported and optimized so it's quite fast.

I'd advocate for this change being the least surprising, and adding it to defaults shouldn't break any existing configurations.

lox avatar Nov 24 '21 23:11 lox

It would be good to codify the minimum required git version for the agent.

Is there a way to feature detect whether the git CLI or remote server supports this and degrade gracefully?

keithduncan avatar Nov 24 '21 23:11 keithduncan

I know some people operate by tagging every commit to the default branch (not sure the reasoning but I know it happens). So I think this could cause performance issues for that sort of thing. Would it be safer to default to off? Though if that's the case, there's almost no point in this change I suppose.
Also, I wonder what the coverage of this change would be - are enough people building on or doing things with tags to make it useful or will it hurt more than it'll help?

Full disclosure: I know nothing about the performance of fetching tags or its recent improvements

jradtilbrook avatar Nov 25 '21 00:11 jradtilbrook

I'd argue this is the sensible default and that folks with weird workflows should opt-out of it.

lox avatar Nov 25 '21 05:11 lox

Version detection with git sounds like a good thing to have @keithduncan.

lox avatar Nov 25 '21 05:11 lox

So I think this could cause performance issues for that sort of thing.

@jradtilbrook given the commit object is already being pulled down, is there reason to think adding a tag ref would incur substantial performance penalties? Looking at the git changelog, there has been lots of work done to make it quick.

lox avatar Nov 25 '21 05:11 lox

@lox I honestly don't know. I was just contributing a thought I had. It's quite possible that it won't - especially since the default is not to perform clean checkouts (unless its a new agent/instance) so pulling a few more commits to what is already there along with their tags is probably no big deal

jradtilbrook avatar Nov 25 '21 06:11 jradtilbrook

@jradtilbrook yeah honestly I’m not sure either!

lox avatar Nov 25 '21 06:11 lox

Without this behaviour in place, I've experienced users frequently running into weird race conditions where the latest reachable tags are based on which build on the host has fetched tags for that repo. It creates weirdly unreproducible bugs for anything that uses tags (for instance goreleaser or any manner of versioning tool), which is a bummer. The answer is always "Oh! Add a git fetch --tags".

It's definitely possible this could break things, but would be awesome to consider for a v4.0.0 release as I think it's a good default.

lox avatar Dec 05 '21 23:12 lox

After living with this change for a year or so, I will say it makes build output very verbose with lots of tags fetched each time 😬

lox avatar Jun 01 '23 07:06 lox