MCPcopy Create free account
hub / github.com/git/git / find_same_and_apply_arg

Function find_same_and_apply_arg

trailer.c:340–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340static int find_same_and_apply_arg(struct list_head *head,
341 struct arg_item *arg_tok)
342{
343 struct list_head *pos;
344 struct trailer_item *in_tok;
345 struct trailer_item *on_tok;
346
347 enum trailer_where where = arg_tok->conf.where;
348 int middle = (where == WHERE_AFTER) || (where == WHERE_BEFORE);
349 int backwards = after_or_end(where);
350 struct trailer_item *start_tok;
351
352 if (list_empty(head))
353 return 0;
354
355 start_tok = list_entry(backwards ? head->prev : head->next,
356 struct trailer_item,
357 list);
358
359 list_for_each_dir(pos, head, backwards) {
360 in_tok = list_entry(pos, struct trailer_item, list);
361 if (!same_token(in_tok, arg_tok))
362 continue;
363 on_tok = middle ? in_tok : start_tok;
364 apply_arg_if_exists(in_tok, arg_tok, on_tok, head);
365 return 1;
366 }
367 return 0;
368}
369
370void process_trailers_lists(struct list_head *head,
371 struct list_head *arg_head)

Callers 1

process_trailers_listsFunction · 0.85

Calls 4

after_or_endFunction · 0.85
list_emptyFunction · 0.85
same_tokenFunction · 0.85
apply_arg_if_existsFunction · 0.85

Tested by

no test coverage detected