aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-08-02 23:37:21 -0400
committerShawn O. Pearce <spearce@spearce.org>2007-08-19 03:38:34 -0400
commitea08a6fd194991f9d800e4cac5ae55fdb02dd235 (patch)
treebc482394c683c355957807fbb40074a7bb1a2b12 /t
parentc905e09006838c209be842dbe740943b2ad2d25b (diff)
downloadgit-ea08a6fd194991f9d800e4cac5ae55fdb02dd235.tar.gz
git-ea08a6fd194991f9d800e4cac5ae55fdb02dd235.tar.xz
Actually allow TAG_FIXUP branches in fast-import
Michael Haggerty <mhagger@alum.mit.edu> noticed while debugging a Git backend for cvs2svn that fast-import was barfing when he tried to use "TAG_FIXUP" as a branch name for temporary work needed to cleanup the tree prior to creating an annotated tag object. The reason we were rejecting the branch name was check_ref_format() returns -2 when there are less than 2 '/' characters in the input name. TAG_FIXUP has 0 '/' characters, but is technically just as valid of a ref as HEAD and MERGE_HEAD, so we really should permit it (and any other similar looking name) during import. New test cases have been added to make sure we still detect very wrong branch names (e.g. containing [ or starting with .) and yet still permit reasonable names (e.g. TAG_FIXUP). Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 't')
-rwxr-xr-xt/t9300-fast-import.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 6f95305bf..dac6135b2 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -170,6 +170,53 @@ test_expect_failure \
'git-fast-import <input'
rm -f .git/objects/pack_* .git/objects/index_*
+cat >input <<INPUT_END
+commit .badbranchname
+committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+data <<COMMIT
+corrupt
+COMMIT
+
+from refs/heads/master
+
+INPUT_END
+test_expect_failure \
+ 'B: fail on invalid branch name ".badbranchname"' \
+ 'git-fast-import <input'
+rm -f .git/objects/pack_* .git/objects/index_*
+
+cat >input <<INPUT_END
+commit bad[branch]name
+committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+data <<COMMIT
+corrupt
+COMMIT
+
+from refs/heads/master
+
+INPUT_END
+test_expect_failure \
+ 'B: fail on invalid branch name "bad[branch]name"' \
+ 'git-fast-import <input'
+rm -f .git/objects/pack_* .git/objects/index_*
+
+cat >input <<INPUT_END
+commit TEMP_TAG
+committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+data <<COMMIT
+tag base
+COMMIT
+
+from refs/heads/master
+
+INPUT_END
+test_expect_success \
+ 'B: accept branch name "TEMP_TAG"' \
+ 'git-fast-import <input &&
+ test -f .git/TEMP_TAG &&
+ test `git rev-parse master` = `git rev-parse TEMP_TAG^`'
+rm -f .git/TEMP_TAG
+
###
### series C
###