commit cb63de52eb578c78c4c4cff41b6494019e3b5c3f from: James Cook via: Thomas Adam date: Thu Sep 21 14:53:04 2023 UTC in diff error message, say what was being diffed When trying to run "got ci" adding a large file, this changes the following error message: got: diff_atomize_file: Cannot allocate memory into: got: /dev/null vs /path/to/the/really/big/file: diff_atomize_file: Cannot allocate memory ok stsp@ commit - 4fca09464de0b3459fa7942804c07e4064481fa0 commit + cb63de52eb578c78c4c4cff41b6494019e3b5c3f blob - 96736bcee618adc7c0693f929dd038909bdeda1d blob + aa67f591fb351d377bca13b28e1dc0b7296e8a96 --- lib/diff.c +++ lib/diff.c @@ -378,8 +378,15 @@ diff_blob_file(struct got_diffreg_result **resultp, err = got_diffreg(&result, f1, f2, diff_algo, ignore_whitespace, force_text_diff); - if (err) + if (err) { + char msg[GOT_ERR_MAX_MSG_SIZE]; + if (snprintf(msg, sizeof(msg), "%s vs %s: %s", + label1 ? label1 : idstr1, + f2_exists ? label2 : "/dev/null", err->msg) >= 0) { + err = got_error_msg(err->code, msg); + } goto done; + } if (outfile) { err = got_diffreg_output(NULL, NULL, result,