PkgBenchmark.jl icon indicating copy to clipboard operation
PkgBenchmark.jl copied to clipboard

Show git dirtiness before throwing an error

Open moble opened this issue 3 years ago • 1 comments

I ran into an error while benchmarking that was pretty hard to track down:

ERROR: /home/runner/work/MyProject.jl/MyProject.jl is dirty. Please commit/stash your changes before benchmarking a specific commit

But the code was a fresh checkout that I hadn't (intentionally) modified. Googling only turned up this discussion, which advised gitignoring some files I was already ignoring. It took me longer than it should have to figure out that the problem was actually something in the build process changing Project.toml. (I had manually edited the [compat] list, and failed to realize that uppercase precedes lowercase, but something in the build process helpfully rectified that mistake, leaving my repo dirty.)

Maybe part of the error message could show the git status and/or diff to show what's actually dirty?

moble avatar Jun 10 '21 14:06 moble

I have the same issue.

How did you even debug it? I only manage to elicit it on github, which makes debugging very slow.

Edit: I sucessfully debugged it now as follows: My benchmark.jl contained the line:

# dc / X_Gen_lin is arbitrary
SUITE["dc"]["X_gen_lin"] = @benchmarkable read(run(`git diff Project.toml`))

Earlier versions had git status to identify the problematic file. This finally gave me output on what was wrong. In my case the /project/Project.toml did not contain BenchmarkCI. After adding it, it worked fine...

behinger avatar Feb 09 '22 21:02 behinger