aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-08-01 02:22:53 -0400
committerShawn O. Pearce <spearce@spearce.org>2007-08-19 03:38:35 -0400
commit1fdb649c6ac4cfc536983077b4851a1959cbc1c4 (patch)
treedcee335dd683ce048e2bd263d73602528e5b9967 /t
parent2c570cde98cfde704ee67ea29031493c633f971e (diff)
downloadgit-1fdb649c6ac4cfc536983077b4851a1959cbc1c4.tar.gz
git-1fdb649c6ac4cfc536983077b4851a1959cbc1c4.tar.xz
Make trailing LF optional for all fast-import commands
For the same reasons as the prior change we want to allow frontends to omit the trailing LF that usually delimits commands. In some cases these just make the input stream more verbose looking than it needs to be, and its just simpler for the frontend developer to get started if our parser is slightly more lenient about where an LF is required and where it isn't. To make this optional LF feature work we now have to buffer up to one line of input in command_buf. This buffering can happen if we look at the current input command but don't recognize it at this point in the code. In such a case we need to "unget" the entire line, but we cannot depend upon the stdio library to let us do ungetc() for that many characters at once. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 't')
-rwxr-xr-xt/t9300-fast-import.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 5be6f196b..5d82b0f1c 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -839,4 +839,50 @@ test_expect_success \
'git-fast-import <input &&
test `git-rev-parse N3` = `git-rev-parse O2`'
+test_expect_success \
+ 'O: repack before next test' \
+ 'git repack -a -d'
+
+cat >input <<INPUT_END
+commit refs/heads/O3
+committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+data <<COMMIT
+zstring
+COMMIT
+commit refs/heads/O3
+committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+data <<COMMIT
+zof
+COMMIT
+checkpoint
+commit refs/heads/O3
+mark :5
+committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+data <<COMMIT
+zempty
+COMMIT
+checkpoint
+commit refs/heads/O3
+committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+data <<COMMIT
+zcommits
+COMMIT
+reset refs/tags/O3-2nd
+from :5
+INPUT_END
+
+cat >expect <<INPUT_END
+string
+of
+empty
+commits
+INPUT_END
+test_expect_success \
+ 'O: blank lines not necessary after other commands' \
+ 'git-fast-import <input &&
+ test 8 = `find .git/objects/pack -type f | wc -l` &&
+ test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&
+ git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
+ git diff expect actual'
+
test_done