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

Function interpret_trailers

builtin/interpret-trailers.c:108–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108static void interpret_trailers(const struct process_trailer_options *opts,
109 struct list_head *new_trailer_head,
110 const char *file)
111{
112 struct strbuf input = STRBUF_INIT;
113 struct strbuf out = STRBUF_INIT;
114 struct tempfile *tempfile = NULL;
115 int fd = 1;
116
117 trailer_config_init();
118
119 read_input_file(&input, file);
120
121 if (opts->in_place) {
122 tempfile = trailer_create_in_place_tempfile(file);
123 if (!tempfile)
124 die(NULL);
125 fd = tempfile->fd;
126 }
127 process_trailers(opts, new_trailer_head, &input, &out);
128
129 if (write_in_full(fd, out.buf, out.len) < 0)
130 die_errno(_("could not write to temporary file '%s'"), file);
131 if (opts->in_place)
132 if (rename_tempfile(&tempfile, file))
133 die_errno(_("could not rename temporary file to %s"), file);
134
135 strbuf_release(&input);
136 strbuf_release(&out);
137}
138
139int cmd_interpret_trailers(int argc,
140 const char **argv,

Callers 1

cmd_interpret_trailersFunction · 0.85

Calls 9

trailer_config_initFunction · 0.85
read_input_fileFunction · 0.85
process_trailersFunction · 0.85
write_in_fullFunction · 0.85
die_errnoFunction · 0.85
rename_tempfileFunction · 0.85
strbuf_releaseFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected