Fossil Forum

fossil grep output does not honour hash-digits setting
Login

fossil grep output does not honour hash-digits setting

fossil grep output does not honour hash-digits setting

(1) By jvdh (veedeehjay) on 2019-11-14 22:17:55 [link] [source]

contrary to 'timeline', 'grep' does always report 10-digit hashes as identifiers. it would be better (for scripting, anyway...) if the hashes were reported always in accordance with the current 'hash-digits' setting.

(2) By Stephan Beal (stephan) on 2019-11-15 02:35:31 in reply to 1 [link] [source]

i have tentatively modified that behaviour in a branch:

[stephan@lapdog:~/fossil/fossil]$ ./fossil grep 'D: grep' src/regexp.c
43b376f739:790:** COMMAND: grep
04d511ced5:790:** COMMAND: grep
21359f8b49:791:** COMMAND: grep
3509e175b8:793:** COMMAND: grep
1a473ddc07:793:** COMMAND: grep
cd369b2979:793:** COMMAND: grep
f44c9481b9:793:** COMMAND: grep
89c45caf71:828:** COMMAND: grep
a5fc3a0fc0:828:** COMMAND: grep
[stephan@lapdog:~/fossil/fossil]$ f set | grep -i leng
[stephan@lapdog:~/fossil/fossil]$ f set | grep -i digi
hash-digits         
[stephan@lapdog:~/fossil/fossil]$ f set hash-digits 18
[stephan@lapdog:~/fossil/fossil]$ ./fossil grep 'D: grep' src/regexp.c
43b376f73904691d10:790:** COMMAND: grep
04d511ced556f1e90f:790:** COMMAND: grep
21359f8b49b95337e4:791:** COMMAND: grep
3509e175b8fdaef0e2:793:** COMMAND: grep
1a473ddc077cd0cbf4:793:** COMMAND: grep
cd369b29797b612644:793:** COMMAND: grep
f44c9481b9c819b513:793:** COMMAND: grep
89c45caf71ab5375a2:828:** COMMAND: grep
a5fc3a0fc08836496d:828:** COMMAND: grep

but because of the potential/hypothetical risk of breaking scripts, i have put it into a branch instead of the trunk:

https://fossil-scm.org/fossil/timeline?r=grep-hash-digits

Is the risk of fallout from that real? Is grep used in such scripted contexts? (i've honestly never used it, so cannot say, and am looking for feedback from those who have.)

FWIW, i'm all for having this in trunk, i'm just (very slightly) concerned about unintended fallout from those who make frequent use that command.

(3) By Richard Hipp (drh) on 2019-11-15 03:03:54 in reply to 2 [link] [source]

My vote is to merge to trunk, but let's wait a few days to see if there is any pushback.

(4) By jvdh (veedeehjay) on 2019-11-15 09:16:53 in reply to 2 [link] [source]

thanks, looks good :).

regarding breaking scripts: in my case the script did break when I set hash-digits to some other value because grep did not honour the setting (since the timeline hashes were no longer identical to the 'grep hashes'). but of course, if some scripts looks for exactly 10 digits rather than >=6 (which seems the minimum fossil allows, irrespective of hash-digit value), then it will choke...

(6) By Stephan Beal (stephan) on 2019-11-19 15:13:57 in reply to 4 [link] [source]

thanks, looks good :).

It's now merged into trunk. Thank you for reporting it (and for choosing to report something which was trivially easy to change ;)).

(7) By jvdh (veedeehjay) on 2019-11-20 12:50:12 in reply to 6 [link] [source]

Thank you for reporting it (and for choosing to report something which was trivially easy to change ;)).

you're welcome! but no promise for the future, though ;)

(5) By Stephan Beal (stephan) on 2019-11-18 07:34:39 in reply to 2 [source]

Last call: if there are objections to the grep UUID length change, please voice them "real soon now," otherwise they'll get merged in tomorrow (Nov. 19th).