MCPcopy Index your code
hub / github.com/git/git / read_oneliner

Function read_oneliner

sequencer.c:590–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

588}
589
590int read_oneliner(struct strbuf *buf,
591 const char *path, unsigned flags)
592{
593 int orig_len = buf->len;
594
595 if (strbuf_read_file(buf, path, 0) < 0) {
596 if ((flags & READ_ONELINER_WARN_MISSING) ||
597 (errno != ENOENT && errno != ENOTDIR))
598 warning_errno(_("could not read '%s'"), path);
599 return 0;
600 }
601
602 if (buf->len > orig_len && buf->buf[buf->len - 1] == '\n') {
603 if (--buf->len > orig_len && buf->buf[buf->len - 1] == '\r')
604 --buf->len;
605 buf->buf[buf->len] = '\0';
606 }
607
608 if ((flags & READ_ONELINER_SKIP_IF_EMPTY) && buf->len == orig_len)
609 return 0;
610
611 return 1;
612}
613
614static struct tree *empty_tree(struct repository *r)
615{

Callers 8

add_one_fileFunction · 0.85
read_strategy_optsFunction · 0.85
read_populate_optsFunction · 0.85
apply_save_autostashFunction · 0.85
pick_commitsFunction · 0.85
commit_staged_changesFunction · 0.85
sequencer_continueFunction · 0.85
read_basic_stateFunction · 0.85

Calls 2

strbuf_read_fileFunction · 0.85
warning_errnoFunction · 0.85

Tested by

no test coverage detected