Page MenuHomeFreeBSD

newvers.sh: Report -dirty also with staged changes
ClosedPublic

Authored by emaste on Wed, Oct 14, 12:47 PM.
Tags
None
Referenced Files
F175997553: D60722.id189866.diff
Thu, Oct 15, 4:05 AM
F175984352: D60722.id189866.diff
Thu, Oct 15, 12:56 AM
F175983978: D60722.diff
Thu, Oct 15, 12:51 AM
Unknown Object (File)
Wed, Oct 14, 6:58 PM
Unknown Object (File)
Wed, Oct 14, 2:46 PM
Unknown Object (File)
Wed, Oct 14, 1:58 PM
Subscribers

Details

Summary

We add -dirty to the uname version string if the tree does not match the reported hash. Previously, staged but uncommitted changes were ignored.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emaste created this revision.

Reported by: @naddy

LGTM, but I'd wait for someone with more git expertise to confirm.

imp accepted this revision.EditedThu, Oct 15, 5:23 PM

HEAD is a universal pseudo tag that we put into the binary when we add a git tag, so it's perfect. Don't know of a better, faster way unless there's something one can do with git status, but this will certainly do until then.

Gemini says, once you boil away the fluff that

git status --porcelain <path>, but includes untracced files unless ignored. It's for general script checks for local modifications. And is the Fastest ๐Ÿš€. It also handles staged files.

So that might be worth pursuing. '-uno' is what you'd add to skip untracked scanning.

This revision is now accepted and ready to land.Thu, Oct 15, 5:23 PM

git status --porcelain <path>, but includes untracced files unless ignored. It's for general script checks for local modifications. And is the Fastest ๐Ÿš€. It also handles staged files.

That doesn't provide a useful return code though. Presumably we could check if git status --porcelain -uno returns any output, but I've already tested this change, and I found that and the git diff command have almost identical execution time.