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

Function run_one_gc_recent_objects_hook

reachable.c:128–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126};
127
128static int run_one_gc_recent_objects_hook(struct oidset *set,
129 const char *args)
130{
131 struct child_process cmd = CHILD_PROCESS_INIT;
132 struct strbuf buf = STRBUF_INIT;
133 FILE *out;
134 int ret = 0;
135
136 cmd.use_shell = 1;
137 cmd.out = -1;
138
139 strvec_push(&cmd.args, args);
140
141 if (start_command(&cmd))
142 return -1;
143
144 out = xfdopen(cmd.out, "r");
145 while (strbuf_getline(&buf, out) != EOF) {
146 struct object_id oid;
147 const char *rest;
148
149 if (parse_oid_hex(buf.buf, &oid, &rest) || *rest) {
150 ret = error(_("invalid extra cruft tip: '%s'"), buf.buf);
151 break;
152 }
153
154 oidset_insert(set, &oid);
155 }
156
157 fclose(out);
158 ret |= finish_command(&cmd);
159
160 strbuf_release(&buf);
161 return ret;
162}
163
164static void load_gc_recent_objects(struct recent_data *data)
165{

Callers 1

load_gc_recent_objectsFunction · 0.85

Calls 9

strvec_pushFunction · 0.85
start_commandFunction · 0.85
xfdopenFunction · 0.85
strbuf_getlineFunction · 0.85
parse_oid_hexFunction · 0.85
errorFunction · 0.85
oidset_insertFunction · 0.85
finish_commandFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected