summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-01-18 20:17:58 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-01-18 20:17:58 (GMT)
commitb715cfbba4083d25ec0d0f94e440ad734607ddb0 (patch)
tree470777f640cddcc55c0ada635f182ce213871e98 /t
parent8232dc427fb4b92b38e74e9e93b52231a67e354f (diff)
downloadgit-b715cfbba4083d25ec0d0f94e440ad734607ddb0.zip
git-b715cfbba4083d25ec0d0f94e440ad734607ddb0.tar.gz
git-b715cfbba4083d25ec0d0f94e440ad734607ddb0.tar.bz2
Accept 'inline' file data in fast-import commit structure.
Its very annoying to need to specify the file content ahead of a commit and use marks to connect the individual blobs to the commit's file modification entry, especially if the frontend can't/won't generate the blob SHA1s itself. Instead it would much easier to use if we can accept the blob data at the same time as we receive each file_change line. Now fast-import accepts 'inline' instead of a mark idnum or blob SHA1 within the 'M' type file_change command. If an inline is detected the very next line must be a 'data n' command, supplying the file data. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 't')
-rwxr-xr-xt/t9300-fast-import.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 40b8c07..a5cc846 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -17,6 +17,12 @@ in 3rd file
file4_data=abcd
file4_len=4
+file5_data='an inline file.
+ we should see it later.'
+
+file6_data='#!/bin/sh
+echo "$@"'
+
###
### series A
###
@@ -181,4 +187,57 @@ test_expect_success \
'C: validate rename result' \
'compare_diff_raw expect actual'
+###
+### series D
+###
+
+test_tick
+cat >input <<INPUT_END
+commit refs/heads/branch
+committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+data <<COMMIT
+third
+COMMIT
+
+from refs/heads/branch^0
+M 644 inline newdir/interesting
+data <<EOF
+$file5_data
+EOF
+
+M 755 inline newdir/exec.sh
+data <<EOF
+$file6_data
+EOF
+
+INPUT_END
+test_expect_success \
+ 'D: inline data in commit' \
+ 'git-fast-import <input &&
+ git-whatchanged branch'
+test_expect_success \
+ 'D: verify pack' \
+ 'for p in .git/objects/pack/*.pack;do git-verify-pack $p||exit;done'
+
+cat >expect <<EOF
+:000000 100755 0000000000000000000000000000000000000000 35a59026a33beac1569b1c7f66f3090ce9c09afc A newdir/exec.sh
+:000000 100644 0000000000000000000000000000000000000000 046d0371e9220107917db0d0e030628de8a1de9b A newdir/interesting
+EOF
+git-diff-tree -M -r branch^ branch >actual
+test_expect_success \
+ 'D: validate new files added' \
+ 'compare_diff_raw expect actual'
+
+echo "$file5_data" >expect
+test_expect_success \
+ 'D: verify file5' \
+ 'git-cat-file blob branch:newdir/interesting >actual &&
+ diff -u expect actual'
+
+echo "$file6_data" >expect
+test_expect_success \
+ 'D: verify file6' \
+ 'git-cat-file blob branch:newdir/exec.sh >actual &&
+ diff -u expect actual'
+
test_done