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

Function record_resolve_undo

resolve-undo.c:12–34  ·  view source on GitHub ↗

The only error case is to run out of memory in string-list */

Source from the content-addressed store, hash-verified

10
11/* The only error case is to run out of memory in string-list */
12void record_resolve_undo(struct index_state *istate, struct cache_entry *ce)
13{
14 struct string_list_item *lost;
15 struct resolve_undo_info *ui;
16 struct string_list *resolve_undo;
17 int stage = ce_stage(ce);
18
19 if (!stage)
20 return;
21
22 if (!istate->resolve_undo) {
23 CALLOC_ARRAY(resolve_undo, 1);
24 resolve_undo->strdup_strings = 1;
25 istate->resolve_undo = resolve_undo;
26 }
27 resolve_undo = istate->resolve_undo;
28 lost = string_list_insert(resolve_undo, ce->name);
29 if (!lost->util)
30 lost->util = xcalloc(1, sizeof(*ui));
31 ui = lost->util;
32 oidcpy(&ui->oid[stage - 1], &ce->oid);
33 ui->mode[stage - 1] = ce->ce_mode;
34}
35
36void resolve_undo_write(struct strbuf *sb, struct string_list *resolve_undo,
37 const struct git_hash_algo *algop)

Callers 1

remove_index_entry_atFunction · 0.85

Calls 3

string_list_insertFunction · 0.85
xcallocFunction · 0.85
oidcpyFunction · 0.85

Tested by

no test coverage detected