MCPcopy Index your code
hub / github.com/git/git / string_list_add_note_lines

Function string_list_add_note_lines

notes.c:875–901  ·  view source on GitHub ↗

* Add the lines from the named object to list, with trailing * newlines removed. */

Source from the content-addressed store, hash-verified

873 * newlines removed.
874 */
875static 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
903static int string_list_join_lines_helper(struct string_list_item *item,
904 void *cb_data)

Callers 1

Calls 3

is_null_oidFunction · 0.85
odb_read_objectFunction · 0.85
string_list_splitFunction · 0.85

Tested by

no test coverage detected