* Add the lines from the named object to list, with trailing * newlines removed. */
| 873 | * newlines removed. |
| 874 | */ |
| 875 | static int string_list_add_note_lines(struct string_list *list, |
| 876 | const struct object_id *oid) |
| 877 | { |
| 878 | char *data; |
| 879 | size_t len; |
| 880 | enum object_type t; |
| 881 | |
| 882 | if (is_null_oid(oid)) |
| 883 | return 0; |
| 884 | |
| 885 | /* read_sha1_file NUL-terminates */ |
| 886 | data = odb_read_object(the_repository->objects, oid, &t, &len); |
| 887 | if (t != OBJ_BLOB || !data || !len) { |
| 888 | free(data); |
| 889 | return t != OBJ_BLOB || !data; |
| 890 | } |
| 891 | |
| 892 | /* |
| 893 | * If the last line of the file is EOL-terminated, this will |
| 894 | * add an empty string to the list. But it will be removed |
| 895 | * later, along with any empty strings that came from empty |
| 896 | * lines within the file. |
| 897 | */ |
| 898 | string_list_split(list, data, "\n", -1); |
| 899 | free(data); |
| 900 | return 0; |
| 901 | } |
| 902 | |
| 903 | static int string_list_join_lines_helper(struct string_list_item *item, |
| 904 | void *cb_data) |
no test coverage detected