{"push_id":553825233,"size":1,"distinct_size":1,"ref":"refs/heads/redis-cli-script-load","head":"7b2fec7344bb078b78743ed00561da132e31ac8b","before":"87e26c25477f4d0ee5e95c80f5acf91de503d9af","commits":[{"sha":"7b2fec7344bb078b78743ed00561da132e31ac8b","author":{"email":"711c73f64afdce07b7e38039a96d2224209e9a6c@chris-lamb.co.uk","name":"Chris Lamb"},"message":"Add --script-load to workaround newline issues with \"SCRIPT LOAD $(cat ..)\"\n\nThe output of `sha1sum /path/to/script.lua` and `redis-cli SCRIPT LOAD\n\"$(cat /path/to/script.lua)\"` will differ if script.lua ends with a\ntrailing newline (surely the majority of cases) as the latter invocation\nstrips the final newline character. The resulting mismatched SHA then\ncauses sysadmin confusion when EVALSHA does not find the corresponding\nscript.\n\nThis patch adds a --script-load argument which loads the file \"internally\",\nbypassing any shell nonsense. eg.\n\n  $ redis-cli --script-load /path/to/script.lua\n  \"add40959283772668fbb821092b603b41b2c6aec\"\n\nOf course, whilst something like:\n\n  $ SHA=\"$(redis-cli SCRIPT LOAD \"$(cat /path/to/script.lua)\")\"\n  $ # .. Now use $SHA, not sha1sum /path/to/script.lua\n\n.. is certainly possible, it is hardly very elegant. :)\n\n(Another alternative would be to change the contract of SCRIPT LOAD such\nthat it does not guarantee to return the SHA1 per-se, merely that it\nreturns /some/ unique identifier...which remains a SHA1 right now. However,\nI bet this would break some existing installations.)\n\nSigned-off-by: Chris Lamb <chris@chris-lamb.co.uk>","distinct":true,"url":"https://api.github.com/repos/lamby/redis/commits/7b2fec7344bb078b78743ed00561da132e31ac8b"}]}