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

Function read_next_command

builtin/fast-import.c:1847–1892  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1845
1846
1847static int read_next_command(void)
1848{
1849 static int stdin_eof = 0;
1850
1851 if (stdin_eof) {
1852 unread_command_buf = 0;
1853 return EOF;
1854 }
1855
1856 for (;;) {
1857 if (unread_command_buf) {
1858 unread_command_buf = 0;
1859 } else {
1860 struct recent_command *rc;
1861
1862 stdin_eof = strbuf_getline_lf(&command_buf, stdin);
1863 if (stdin_eof)
1864 return EOF;
1865
1866 if (!seen_data_command
1867 && !starts_with(command_buf.buf, "feature ")
1868 && !starts_with(command_buf.buf, "option ")) {
1869 parse_argv();
1870 }
1871
1872 rc = rc_free;
1873 if (rc)
1874 rc_free = rc->next;
1875 else {
1876 rc = cmd_hist.next;
1877 cmd_hist.next = rc->next;
1878 cmd_hist.next->prev = &cmd_hist;
1879 free(rc->buf);
1880 }
1881
1882 rc->buf = xstrdup(command_buf.buf);
1883 rc->prev = cmd_tail;
1884 rc->next = cmd_hist.prev;
1885 rc->prev->next = rc;
1886 cmd_tail = rc;
1887 }
1888 if (command_buf.buf[0] == '#')
1889 continue;
1890 return 0;
1891 }
1892}
1893
1894static void skip_optional_lf(void)
1895{

Callers 14

parse_markFunction · 0.85
parse_new_blobFunction · 0.85
file_change_mFunction · 0.85
note_change_nFunction · 0.85
parse_objectishFunction · 0.85
parse_mergeFunction · 0.85
parse_one_signatureFunction · 0.85
discard_one_signatureFunction · 0.85
parse_new_commitFunction · 0.85
parse_new_tagFunction · 0.85
parse_reset_branchFunction · 0.85

Calls 4

strbuf_getline_lfFunction · 0.85
starts_withFunction · 0.85
xstrdupFunction · 0.85
parse_argvFunction · 0.70

Tested by

no test coverage detected