75
# stream formatting is: \, " and LF. Otherwise these values
76
# are UTF8.
77
#
78
- ref_str ::= ref | '"' quoted(ref) '"' ;
79
- sha1exp_str ::= sha1exp | '"' quoted(sha1exp) '"' ;
80
- tag_str ::= tag | '"' quoted(tag) '"' ;
78
+ ref_str ::= ref;
79
+ sha1exp_str ::= sha1exp;
80
+ tag_str ::= tag;
81
path_str ::= path | '"' quoted(path) '"' ;
82
mode ::= '100644' | '644'
83
| '100755' | '755'
1546
1547
static void cmd_from(struct branch *b)
1548
{
1549
- const char *from, *endp;
1550
- char *str_uq;
1549
+ const char *from;
1550
struct branch *s;
1551
1552
if (strncmp("from ", command_buf.buf, 5))
1556
die("Can't reinitailize branch %s", b->name);
1557
1558
from = strchr(command_buf.buf, ' ') + 1;
1560
- str_uq = unquote_c_style(from, &endp);
1561
- if (str_uq) {
1562
- if (*endp)
1563
- die("Garbage after string in: %s", command_buf.buf);
1564
- from = str_uq;
1565
- }
1566
-
1559
s = lookup_branch(from);
1560
if (b == s)
1561
die("Can't create a branch from itself: %s", b->name);
1609
static struct hash_list* cmd_merge(unsigned int *count)
1610
{
1611
struct hash_list *list = NULL, *n, *e;
1620
- const char *from, *endp;
1621
- char *str_uq;
1612
+ const char *from;
1613
struct branch *s;
1614
1615
*count = 0;
1616
while (!strncmp("merge ", command_buf.buf, 6)) {
1617
from = strchr(command_buf.buf, ' ') + 1;
1627
- str_uq = unquote_c_style(from, &endp);
1628
- if (str_uq) {
1629
- if (*endp)
1630
- die("Garbage after string in: %s", command_buf.buf);
1631
- from = str_uq;
1632
- }
1633
-
1618
n = xmalloc(sizeof(*n));
1619
s = lookup_branch(from);
1620
if (s)
1645
struct branch *b;
1646
void *msg;
1647
size_t msglen;
1664
- char *str_uq;
1665
- const char *endp;
1648
char *sp;
1649
char *author = NULL;
1650
char *committer = NULL;
1653
1654
/* Obtain the branch name from the rest of our command */
1655
sp = strchr(command_buf.buf, ' ') + 1;
1674
- str_uq = unquote_c_style(sp, &endp);
1675
- if (str_uq) {
1676
- if (*endp)
1677
- die("Garbage after ref in: %s", command_buf.buf);
1678
- sp = str_uq;
1679
- }
1656
b = lookup_branch(sp);
1657
if (!b)
1658
b = new_branch(sp);
1683
- if (str_uq)
1684
- free(str_uq);
1659
1660
read_next_command();
1661
cmd_mark();
1746
1747
static void cmd_new_tag(void)
1748
{
1775
- char *str_uq;
1776
- const char *endp;
1749
char *sp;
1750
const char *from;
1751
char *tagger;
1758
1759
/* Obtain the new tag name from the rest of our command */
1760
sp = strchr(command_buf.buf, ' ') + 1;
1789
- str_uq = unquote_c_style(sp, &endp);
1790
- if (str_uq) {
1791
- if (*endp)
1792
- die("Garbage after tag name in: %s", command_buf.buf);
1793
- sp = str_uq;
1794
- }
1761
t = pool_alloc(sizeof(struct tag));
1762
t->next_tag = NULL;
1763
t->name = pool_strdup(sp);
1766
else
1767
first_tag = t;
1768
last_tag = t;
1803
- if (str_uq)
1804
- free(str_uq);
1769
read_next_command();
1770
1771
/* from ... */
1772
if (strncmp("from ", command_buf.buf, 5))
1773
die("Expected from command, got %s", command_buf.buf);
1810
-
1774
from = strchr(command_buf.buf, ' ') + 1;
1812
- str_uq = unquote_c_style(from, &endp);
1813
- if (str_uq) {
1814
- if (*endp)
1815
- die("Garbage after string in: %s", command_buf.buf);
1816
- from = str_uq;
1817
- }
1818
-
1775
s = lookup_branch(from);
1776
if (s) {
1777
hashcpy(sha1, s->sha1);
1792
free(buf);
1793
} else
1794
die("Invalid ref name or SHA1 expression: %s", from);
1839
-
1840
- if (str_uq)
1841
- free(str_uq);
1795
read_next_command();
1796
1797
/* tagger ... */
1838
static void cmd_reset_branch(void)
1839
{
1840
struct branch *b;
1888
- char *str_uq;
1889
- const char *endp;
1841
char *sp;
1842
1843
/* Obtain the branch name from the rest of our command */
1844
sp = strchr(command_buf.buf, ' ') + 1;
1894
- str_uq = unquote_c_style(sp, &endp);
1895
- if (str_uq) {
1896
- if (*endp)
1897
- die("Garbage after ref in: %s", command_buf.buf);
1898
- sp = str_uq;
1899
- }
1845
b = lookup_branch(sp);
1846
if (b) {
1847
b->last_commit = 0;
1852
}
1853
else
1854
b = new_branch(sp);
1910
- if (str_uq)
1911
- free(str_uq);
1855
read_next_command();
1856
cmd_from(b);
1857
}