# stream formatting is: \, " and LF. Otherwise these values
# are UTF8.
#
- ref_str ::= ref | '"' quoted(ref) '"' ;
- sha1exp_str ::= sha1exp | '"' quoted(sha1exp) '"' ;
- tag_str ::= tag | '"' quoted(tag) '"' ;
+ ref_str ::= ref;
+ sha1exp_str ::= sha1exp;
+ tag_str ::= tag;
path_str ::= path | '"' quoted(path) '"' ;
mode ::= '100644' | '644'
| '100755' | '755'
static void cmd_from(struct branch *b)
{
- const char *from, *endp;
- char *str_uq;
+ const char *from;
struct branch *s;
if (strncmp("from ", command_buf.buf, 5))
die("Can't reinitailize branch %s", b->name);
from = strchr(command_buf.buf, ' ') + 1;
- str_uq = unquote_c_style(from, &endp);
- if (str_uq) {
- if (*endp)
- die("Garbage after string in: %s", command_buf.buf);
- from = str_uq;
- }
-
s = lookup_branch(from);
if (b == s)
die("Can't create a branch from itself: %s", b->name);
static struct hash_list* cmd_merge(unsigned int *count)
{
struct hash_list *list = NULL, *n, *e;
- const char *from, *endp;
- char *str_uq;
+ const char *from;
struct branch *s;
*count = 0;
while (!strncmp("merge ", command_buf.buf, 6)) {
from = strchr(command_buf.buf, ' ') + 1;
- str_uq = unquote_c_style(from, &endp);
- if (str_uq) {
- if (*endp)
- die("Garbage after string in: %s", command_buf.buf);
- from = str_uq;
- }
-
n = xmalloc(sizeof(*n));
s = lookup_branch(from);
if (s)
struct branch *b;
void *msg;
size_t msglen;
- char *str_uq;
- const char *endp;
char *sp;
char *author = NULL;
char *committer = NULL;
/* Obtain the branch name from the rest of our command */
sp = strchr(command_buf.buf, ' ') + 1;
- str_uq = unquote_c_style(sp, &endp);
- if (str_uq) {
- if (*endp)
- die("Garbage after ref in: %s", command_buf.buf);
- sp = str_uq;
- }
b = lookup_branch(sp);
if (!b)
b = new_branch(sp);
- if (str_uq)
- free(str_uq);
read_next_command();
cmd_mark();
static void cmd_new_tag(void)
{
- char *str_uq;
- const char *endp;
char *sp;
const char *from;
char *tagger;
/* Obtain the new tag name from the rest of our command */
sp = strchr(command_buf.buf, ' ') + 1;
- str_uq = unquote_c_style(sp, &endp);
- if (str_uq) {
- if (*endp)
- die("Garbage after tag name in: %s", command_buf.buf);
- sp = str_uq;
- }
t = pool_alloc(sizeof(struct tag));
t->next_tag = NULL;
t->name = pool_strdup(sp);
else
first_tag = t;
last_tag = t;
- if (str_uq)
- free(str_uq);
read_next_command();
/* from ... */
if (strncmp("from ", command_buf.buf, 5))
die("Expected from command, got %s", command_buf.buf);
-
from = strchr(command_buf.buf, ' ') + 1;
- str_uq = unquote_c_style(from, &endp);
- if (str_uq) {
- if (*endp)
- die("Garbage after string in: %s", command_buf.buf);
- from = str_uq;
- }
-
s = lookup_branch(from);
if (s) {
hashcpy(sha1, s->sha1);
free(buf);
} else
die("Invalid ref name or SHA1 expression: %s", from);
-
- if (str_uq)
- free(str_uq);
read_next_command();
/* tagger ... */
static void cmd_reset_branch(void)
{
struct branch *b;
- char *str_uq;
- const char *endp;
char *sp;
/* Obtain the branch name from the rest of our command */
sp = strchr(command_buf.buf, ' ') + 1;
- str_uq = unquote_c_style(sp, &endp);
- if (str_uq) {
- if (*endp)
- die("Garbage after ref in: %s", command_buf.buf);
- sp = str_uq;
- }
b = lookup_branch(sp);
if (b) {
b->last_commit = 0;
}
else
b = new_branch(sp);
- if (str_uq)
- free(str_uq);
read_next_command();
cmd_from(b);
}