summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2007-01-11 22:28:39 -0500
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2007-01-14 02:15:12 -0500
commit9938ffc53a15c755bbd3894c02492b940ea34c4c (patch)
tree899f7707a845c93a53ecb1e01d0045143e1ce65f
parentSupport creation of merge commits in fast-import. (diff)
downloadtgif-9938ffc53a15c755bbd3894c02492b940ea34c4c.tar.xz
Allow creating branches without committing in fast-import.
Some importers may want to create a branch long before they actually commit to it, or in some cases they may never commit to the branch but they still need the ref to be created in the repository after the import is complete. This extends the 'reset ' command to automatically create a new branch if the supplied reference isn't already known as a branch. While I'm at it I also modified the syntax of the reset command to terminate with an empty line, like commit and tag operate. This just makes the command set more consistent. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--fast-import.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fast-import.c b/fast-import.c
index 15db4b39d1..38e24bf6a6 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -36,7 +36,9 @@ Format of STDIN stream:
tag_msg;
tag_msg ::= data;
- reset_branch ::= 'reset' sp ref_str lf;
+ reset_branch ::= 'reset' sp ref_str lf
+ ('from' sp (ref_str | hexsha1 | sha1exp_str | idnum) lf)?
+ lf;
# note: the first idnum in a stream should be 1 and subsequent
# idnums should not have gaps between values as this will cause
@@ -1794,8 +1796,12 @@ static void cmd_reset_branch()
b->branch_tree.tree = NULL;
}
}
+ else
+ b = new_branch(sp);
if (str_uq)
free(str_uq);
+ read_next_command();
+ cmd_from(b);
}
static const char fast_import_usage[] =