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

Function template_untouched

sequencer.c:1239–1257  ·  view source on GitHub ↗

* See if the user edited the message in the editor or left what * was in the template intact */

Source from the content-addressed store, hash-verified

1237 * was in the template intact
1238 */
1239int template_untouched(const struct strbuf *sb, const char *template_file,
1240 enum commit_msg_cleanup_mode cleanup_mode)
1241{
1242 struct strbuf tmpl = STRBUF_INIT;
1243 const char *start;
1244
1245 if (cleanup_mode == COMMIT_MSG_CLEANUP_NONE && sb->len)
1246 return 0;
1247
1248 if (!template_file || strbuf_read_file(&tmpl, template_file, 0) <= 0)
1249 return 0;
1250
1251 strbuf_stripspace(&tmpl,
1252 cleanup_mode == COMMIT_MSG_CLEANUP_ALL ? comment_line_str : NULL);
1253 if (!skip_prefix(sb->buf, tmpl.buf, &start))
1254 start = sb->buf;
1255 strbuf_release(&tmpl);
1256 return rest_is_empty(sb, start - sb->buf);
1257}
1258
1259int update_head_with_reflog(const struct commit *old_head,
1260 const struct object_id *new_head,

Callers 1

cmd_commitFunction · 0.85

Calls 4

strbuf_read_fileFunction · 0.85
strbuf_stripspaceFunction · 0.85
strbuf_releaseFunction · 0.85
rest_is_emptyFunction · 0.85

Tested by

no test coverage detected