From: Linus Torvalds Date: Tue, 24 May 2005 16:06:51 +0000 (-0700) Subject: Fix cvs2git branch handling X-Git-Tag: v0.99.2~51^2~10 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e69a19f784b3ff19efc8ab765166e877fffb052e;p=git.git Fix cvs2git branch handling .. and tell 'co' to shut up about the rcs noise. This still leaves some branch issues up in the air: it looks like cvsps has some questionable originating branch information, but I don't know whether that's a cvsps bug or an actual bug in the syslinux archive I'm using to test. I'll let David Mansfield answer my questions about CVS. I'm a total idiot when it comes to branches under CVS ("I'm pure!"). --- diff --git a/cvs2git.c b/cvs2git.c index c18f904f..2ac53ea8 100644 --- a/cvs2git.c +++ b/cvs2git.c @@ -82,18 +82,24 @@ static void prepare_commit(void) if (!strcmp(src_branch, "HEAD")) src_branch = "master"; printf("ln -sf refs/heads/'%s' .git/HEAD\n", src_branch); - printf("git-read-tree -m HEAD\n"); + printf("git-read-tree -m HEAD || exit 1\n"); printf("git-checkout-cache -f -u -a\n"); } static void commit(void) { const char *cmit_parent = initial_commit ? "" : "-p HEAD"; + const char *dst_branch; printf("tree=$(git-write-tree)\n"); printf("cat > .cmitmsg < .git/HEAD\n"); + + dst_branch = branch; + if (!strcmp(dst_branch, "HEAD")) + dst_branch = "master"; + + printf("echo $commit > .git/refs/heads/'%s'\n", dst_branch); *date = 0; *author = 0; @@ -154,7 +160,7 @@ static void update_file(char *line) get_rcs_name(rcspathname, name, dir); - printf("co -p -r%s '%s' > '%s'\n", version, rcspathname, name); + printf("co -q -p -r%s '%s' > '%s'\n", version, rcspathname, name); printf("git-update-cache --add -- '%s'\n", name); }