gup icon indicating copy to clipboard operation
gup copied to clipboard

gup --leave emits warning

Open gkleen opened this issue 8 years ago • 3 comments

Should gup --leave really emit the x modified y directly-warning?

gkleen avatar Oct 25 '17 11:10 gkleen

Nope, it shouldn't

timbertson avatar Oct 26 '17 01:10 timbertson

With a file b (with arbitrary content) and a buildscript b.gup with content as follows:

#!/usr/bin/env zsh

gup --leave

I get the following behaviour:

$ gup b
gup b
gup  b.gup modified ./b directly
$ gup b
gup b
gup  b.gup modified ./b directly

gkleen avatar Nov 13 '17 16:11 gkleen

I looked into this today. The clobbering stuff is a bit of a weird heuristic to try and balance annoyance with usefulness. Also it uses the previous build's state, not the current build. It does already suppress the warning if the previous build clobbered the target, but only for an update (gup -u).

The idea is that you'll mostly run gup target for a target you're modifying/testing, most other builds of a clobbering target should come from gup -u. And the warning is most useful when you're working on the target, just in case you didn't mean to make it clobber the output.

So long story short: it would take a fair bit of code (and a slight performance impact) to make this always work correctly for --leave, and it already doesn't warn if you use gup --leave and you gup -u your target. So it's a bug, but it's at most a nuisance and it will only appear on a clean build if you use gup -u.

timbertson avatar Jan 07 '18 10:01 timbertson