@matheusbsbs / matheus-bagliano / commits / b30317819d
Fork 0

git-fast-import: rename cmd_*() functions to parse_*()

There is a cmd_merge() function in fast-import that will conflict with builtin-merge's cmd_merge() function. To keep it consistent, rename all cmd_*() function to parse_*() Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Miklos Vajna committed May 16, 2008 at 00:35 UTC b30317819dcbcb99a9ef520631e6ab002b6755a0
1 file changed +31 -31
fast-import.c
+31 -31
@@ -1690,7 +1690,7 @@ static void skip_optional_lf(void)
1690 ungetc(term_char, stdin);
1691 }
1692
1693 -static void cmd_mark(void)
1693 +static void parse_mark(void)
1694 {
1695 if (!prefixcmp(command_buf.buf, "mark :")) {
1696 next_mark = strtoumax(command_buf.buf + 6, NULL, 10);
@@ -1700,7 +1700,7 @@ static void cmd_mark(void)
1700 next_mark = 0;
1701 }
1702
1703 -static void cmd_data(struct strbuf *sb)
1703 +static void parse_data(struct strbuf *sb)
1704 {
1705 strbuf_reset(sb);
1706
@@ -1798,13 +1798,13 @@ static char *parse_ident(const char *buf)
1798 return ident;
1799 }
1800
1801 -static void cmd_new_blob(void)
1801 +static void parse_new_blob(void)
1802 {
1803 static struct strbuf buf = STRBUF_INIT;
1804
1805 read_next_command();
1806 - cmd_mark();
1807 - cmd_data(&buf);
1806 + parse_mark();
1807 + parse_data(&buf);
1808 store_object(OBJ_BLOB, &buf, &last_blob, NULL, next_mark);
1809 }
1810
@@ -1908,7 +1908,7 @@ static void file_change_m(struct branch *b)
1908 p = uq.buf;
1909 }
1910 read_next_command();
1911 - cmd_data(&buf);
1911 + parse_data(&buf);
1912 store_object(OBJ_BLOB, &buf, &last_blob, sha1, 0);
1913 } else if (oe) {
1914 if (oe->type != OBJ_BLOB)
@@ -1995,7 +1995,7 @@ static void file_change_deleteall(struct branch *b)
1995 load_tree(&b->branch_tree);
1996 }
1997
1998 -static void cmd_from_commit(struct branch *b, char *buf, unsigned long size)
1998 +static void parse_from_commit(struct branch *b, char *buf, unsigned long size)
1999 {
2000 if (!buf || size < 46)
2001 die("Not a valid commit: %s", sha1_to_hex(b->sha1));
@@ -2006,7 +2006,7 @@ static void cmd_from_commit(struct branch *b, char *buf, unsigned long size)
2006 b->branch_tree.versions[1].sha1);
2007 }
2008
2009 -static void cmd_from_existing(struct branch *b)
2009 +static void parse_from_existing(struct branch *b)
2010 {
2011 if (is_null_sha1(b->sha1)) {
2012 hashclr(b->branch_tree.versions[0].sha1);
@@ -2017,12 +2017,12 @@ static void cmd_from_existing(struct branch *b)
2017
2018 buf = read_object_with_reference(b->sha1,
2019 commit_type, &size, b->sha1);
2020 - cmd_from_commit(b, buf, size);
2020 + parse_from_commit(b, buf, size);
2021 free(buf);
2022 }
2023 }
2024
2025 -static int cmd_from(struct branch *b)
2025 +static int parse_from(struct branch *b)
2026 {
2027 const char *from;
2028 struct branch *s;
@@ -2053,12 +2053,12 @@ static int cmd_from(struct branch *b)
2053 if (oe->pack_id != MAX_PACK_ID) {
2054 unsigned long size;
2055 char *buf = gfi_unpack_entry(oe, &size);
2056 - cmd_from_commit(b, buf, size);
2056 + parse_from_commit(b, buf, size);
2057 free(buf);
2058 } else
2059 - cmd_from_existing(b);
2059 + parse_from_existing(b);
2060 } else if (!get_sha1(from, b->sha1))
2061 - cmd_from_existing(b);
2061 + parse_from_existing(b);
2062 else
2063 die("Invalid ref name or SHA1 expression: %s", from);
2064
@@ -2066,7 +2066,7 @@ static int cmd_from(struct branch *b)
2066 return 1;
2067 }
2068
2069 -static struct hash_list *cmd_merge(unsigned int *count)
2069 +static struct hash_list *parse_merge(unsigned int *count)
2070 {
2071 struct hash_list *list = NULL, *n, *e = e;
2072 const char *from;
@@ -2107,7 +2107,7 @@ static struct hash_list *cmd_merge(unsigned int *count)
2107 return list;
2108 }
2109
2110 -static void cmd_new_commit(void)
2110 +static void parse_new_commit(void)
2111 {
2112 static struct strbuf msg = STRBUF_INIT;
2113 struct branch *b;
@@ -2124,7 +2124,7 @@ static void cmd_new_commit(void)
2124 b = new_branch(sp);
2125
2126 read_next_command();
2127 - cmd_mark();
2127 + parse_mark();
2128 if (!prefixcmp(command_buf.buf, "author ")) {
2129 author = parse_ident(command_buf.buf + 7);
2130 read_next_command();
@@ -2135,10 +2135,10 @@ static void cmd_new_commit(void)
2135 }
2136 if (!committer)
2137 die("Expected committer but didn't get one");
2138 - cmd_data(&msg);
2138 + parse_data(&msg);
2139 read_next_command();
2140 - cmd_from(b);
2141 - merge_list = cmd_merge(&merge_count);
2140 + parse_from(b);
2141 + merge_list = parse_merge(&merge_count);
2142
2143 /* ensure the branch is active/loaded */
2144 if (!b->branch_tree.tree || !max_active_branches) {
@@ -2196,7 +2196,7 @@ static void cmd_new_commit(void)
2196 b->last_commit = object_count_by_type[OBJ_COMMIT];
2197 }
2198
2199 -static void cmd_new_tag(void)
2199 +static void parse_new_tag(void)
2200 {
2201 static struct strbuf msg = STRBUF_INIT;
2202 char *sp;
@@ -2253,7 +2253,7 @@ static void cmd_new_tag(void)
2253
2254 /* tag payload/message */
2255 read_next_command();
2256 - cmd_data(&msg);
2256 + parse_data(&msg);
2257
2258 /* build the tag object */
2259 strbuf_reset(&new_data);
@@ -2273,7 +2273,7 @@ static void cmd_new_tag(void)
2273 t->pack_id = pack_id;
2274 }
2275
2276 -static void cmd_reset_branch(void)
2276 +static void parse_reset_branch(void)
2277 {
2278 struct branch *b;
2279 char *sp;
@@ -2293,12 +2293,12 @@ static void cmd_reset_branch(void)
2293 else
2294 b = new_branch(sp);
2295 read_next_command();
2296 - cmd_from(b);
2296 + parse_from(b);
2297 if (command_buf.len > 0)
2298 unread_command_buf = 1;
2299 }
2300
2301 -static void cmd_checkpoint(void)
2301 +static void parse_checkpoint(void)
2302 {
2303 if (object_count) {
2304 cycle_packfile();
@@ -2309,7 +2309,7 @@ static void cmd_checkpoint(void)
2309 skip_optional_lf();
2310 }
2311
2312 -static void cmd_progress(void)
2312 +static void parse_progress(void)
2313 {
2314 fwrite(command_buf.buf, 1, command_buf.len, stdout);
2315 fputc('\n', stdout);
@@ -2449,17 +2449,17 @@ int main(int argc, const char **argv)
2449 set_die_routine(die_nicely);
2450 while (read_next_command() != EOF) {
2451 if (!strcmp("blob", command_buf.buf))
2452 - cmd_new_blob();
2452 + parse_new_blob();
2453 else if (!prefixcmp(command_buf.buf, "commit "))
2454 - cmd_new_commit();
2454 + parse_new_commit();
2455 else if (!prefixcmp(command_buf.buf, "tag "))
2456 - cmd_new_tag();
2456 + parse_new_tag();
2457 else if (!prefixcmp(command_buf.buf, "reset "))
2458 - cmd_reset_branch();
2458 + parse_reset_branch();
2459 else if (!strcmp("checkpoint", command_buf.buf))
2460 - cmd_checkpoint();
2460 + parse_checkpoint();
2461 else if (!prefixcmp(command_buf.buf, "progress "))
2462 - cmd_progress();
2462 + parse_progress();
2463 else
2464 die("Unsupported command: %s", command_buf.buf);
2465 }