2007-01-18 19:26:24 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2007 Shawn Pearce
|
|
|
|
#
|
|
|
|
|
|
|
|
test_description='test git-fast-import utility'
|
|
|
|
. ./test-lib.sh
|
|
|
|
. ../diff-lib.sh ;# test-lib chdir's into trash
|
|
|
|
|
2007-01-18 20:49:05 +01:00
|
|
|
file2_data='file2
|
|
|
|
second line of EOF'
|
|
|
|
|
|
|
|
file3_data='EOF
|
|
|
|
in 3rd file
|
|
|
|
END'
|
|
|
|
|
|
|
|
file4_data=abcd
|
|
|
|
file4_len=4
|
|
|
|
|
2007-01-18 21:17:58 +01:00
|
|
|
file5_data='an inline file.
|
|
|
|
we should see it later.'
|
|
|
|
|
|
|
|
file6_data='#!/bin/sh
|
|
|
|
echo "$@"'
|
|
|
|
|
2007-01-18 19:26:24 +01:00
|
|
|
###
|
|
|
|
### series A
|
|
|
|
###
|
|
|
|
|
|
|
|
test_tick
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
blob
|
|
|
|
mark :2
|
|
|
|
data <<EOF
|
2007-01-18 20:49:05 +01:00
|
|
|
$file2_data
|
2007-01-18 19:26:24 +01:00
|
|
|
EOF
|
|
|
|
|
|
|
|
blob
|
|
|
|
mark :3
|
|
|
|
data <<END
|
2007-01-18 20:49:05 +01:00
|
|
|
$file3_data
|
2007-01-18 19:26:24 +01:00
|
|
|
END
|
|
|
|
|
|
|
|
blob
|
|
|
|
mark :4
|
2007-01-18 20:49:05 +01:00
|
|
|
data $file4_len
|
|
|
|
$file4_data
|
2007-01-18 19:26:24 +01:00
|
|
|
commit refs/heads/master
|
|
|
|
mark :5
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
initial
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
M 644 :2 file2
|
|
|
|
M 644 :3 file3
|
|
|
|
M 755 :4 file4
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
test_expect_success \
|
|
|
|
'A: create pack from stdin' \
|
|
|
|
'git-fast-import --export-marks=marks.out <input &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git whatchanged master'
|
2007-01-18 19:26:24 +01:00
|
|
|
test_expect_success \
|
|
|
|
'A: verify pack' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
|
2007-01-18 19:26:24 +01:00
|
|
|
|
|
|
|
cat >expect <<EOF
|
|
|
|
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
|
|
|
|
initial
|
|
|
|
EOF
|
|
|
|
test_expect_success \
|
|
|
|
'A: verify commit' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'git cat-file commit master | sed 1d >actual &&
|
2007-02-25 23:36:53 +01:00
|
|
|
git diff expect actual'
|
2007-01-18 19:26:24 +01:00
|
|
|
|
|
|
|
cat >expect <<EOF
|
|
|
|
100644 blob file2
|
|
|
|
100644 blob file3
|
|
|
|
100755 blob file4
|
|
|
|
EOF
|
|
|
|
test_expect_success \
|
|
|
|
'A: verify tree' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
|
2007-02-25 23:36:53 +01:00
|
|
|
git diff expect actual'
|
2007-01-18 19:26:24 +01:00
|
|
|
|
2007-01-18 20:49:05 +01:00
|
|
|
echo "$file2_data" >expect
|
2007-01-18 19:26:24 +01:00
|
|
|
test_expect_success \
|
|
|
|
'A: verify file2' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'git cat-file blob master:file2 >actual && git diff expect actual'
|
2007-01-18 19:26:24 +01:00
|
|
|
|
2007-01-18 20:49:05 +01:00
|
|
|
echo "$file3_data" >expect
|
2007-01-18 19:26:24 +01:00
|
|
|
test_expect_success \
|
|
|
|
'A: verify file3' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'git cat-file blob master:file3 >actual && git diff expect actual'
|
2007-01-18 19:26:24 +01:00
|
|
|
|
2007-01-18 20:49:05 +01:00
|
|
|
printf "$file4_data" >expect
|
2007-01-18 19:26:24 +01:00
|
|
|
test_expect_success \
|
|
|
|
'A: verify file4' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'git cat-file blob master:file4 >actual && git diff expect actual'
|
2007-01-18 19:26:24 +01:00
|
|
|
|
|
|
|
cat >expect <<EOF
|
2007-07-03 07:52:14 +02:00
|
|
|
:2 `git rev-parse --verify master:file2`
|
|
|
|
:3 `git rev-parse --verify master:file3`
|
|
|
|
:4 `git rev-parse --verify master:file4`
|
|
|
|
:5 `git rev-parse --verify master^0`
|
2007-01-18 19:26:24 +01:00
|
|
|
EOF
|
|
|
|
test_expect_success \
|
|
|
|
'A: verify marks output' \
|
2007-02-25 23:36:53 +01:00
|
|
|
'git diff expect marks.out'
|
2007-01-18 19:26:24 +01:00
|
|
|
|
2007-03-08 00:07:26 +01:00
|
|
|
test_expect_success \
|
|
|
|
'A: verify marks import' \
|
|
|
|
'git-fast-import \
|
|
|
|
--import-marks=marks.out \
|
|
|
|
--export-marks=marks.new \
|
|
|
|
</dev/null &&
|
2007-03-11 08:26:33 +01:00
|
|
|
git diff -u expect marks.new'
|
2007-03-08 00:07:26 +01:00
|
|
|
|
2007-05-24 06:32:31 +02:00
|
|
|
test_tick
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/verify--import-marks
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
recreate from :5
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from :5
|
|
|
|
M 755 :2 copy-of-file2
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
test_expect_success \
|
|
|
|
'A: verify marks import does not crash' \
|
|
|
|
'git-fast-import --import-marks=marks.out <input &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git whatchanged verify--import-marks'
|
2007-05-24 06:32:31 +02:00
|
|
|
test_expect_success \
|
|
|
|
'A: verify pack' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
|
2007-05-24 06:32:31 +02:00
|
|
|
cat >expect <<EOF
|
|
|
|
:000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
|
|
|
|
EOF
|
2007-07-03 07:52:14 +02:00
|
|
|
git diff-tree -M -r master verify--import-marks >actual
|
2007-05-24 06:32:31 +02:00
|
|
|
test_expect_success \
|
|
|
|
'A: verify diff' \
|
|
|
|
'compare_diff_raw expect actual &&
|
2007-07-03 07:52:14 +02:00
|
|
|
test `git rev-parse --verify master:file2` \
|
|
|
|
= `git rev-parse --verify verify--import-marks:copy-of-file2`'
|
2007-05-24 06:32:31 +02:00
|
|
|
|
2007-01-18 19:26:24 +01:00
|
|
|
###
|
|
|
|
### series B
|
|
|
|
###
|
|
|
|
|
|
|
|
test_tick
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/branch
|
|
|
|
mark :1
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
corrupt
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/master
|
|
|
|
M 755 0000000000000000000000000000000000000001 zero1
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
test_expect_failure \
|
|
|
|
'B: fail on invalid blob sha1' \
|
|
|
|
'git-fast-import <input'
|
|
|
|
rm -f .git/objects/pack_* .git/objects/index_*
|
|
|
|
|
|
|
|
###
|
|
|
|
### series C
|
|
|
|
###
|
|
|
|
|
|
|
|
newf=`echo hi newf | git-hash-object -w --stdin`
|
2007-07-03 07:52:14 +02:00
|
|
|
oldf=`git rev-parse --verify master:file2`
|
2007-01-18 19:26:24 +01:00
|
|
|
test_tick
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/branch
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
second
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/master
|
|
|
|
M 644 $oldf file2/oldf
|
|
|
|
M 755 $newf file2/newf
|
|
|
|
D file3
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
test_expect_success \
|
|
|
|
'C: incremental import create pack from stdin' \
|
|
|
|
'git-fast-import <input &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git whatchanged branch'
|
2007-01-18 19:26:24 +01:00
|
|
|
test_expect_success \
|
|
|
|
'C: verify pack' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
|
2007-01-18 19:26:24 +01:00
|
|
|
test_expect_success \
|
|
|
|
'C: validate reuse existing blob' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'test $newf = `git rev-parse --verify branch:file2/newf`
|
|
|
|
test $oldf = `git rev-parse --verify branch:file2/oldf`'
|
2007-01-18 19:26:24 +01:00
|
|
|
|
|
|
|
cat >expect <<EOF
|
2007-07-03 07:52:14 +02:00
|
|
|
parent `git rev-parse --verify master^0`
|
2007-01-18 19:26:24 +01:00
|
|
|
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
|
|
|
|
second
|
|
|
|
EOF
|
|
|
|
test_expect_success \
|
|
|
|
'C: verify commit' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'git cat-file commit branch | sed 1d >actual &&
|
2007-02-25 23:36:53 +01:00
|
|
|
git diff expect actual'
|
2007-01-18 19:26:24 +01:00
|
|
|
|
|
|
|
cat >expect <<EOF
|
|
|
|
:000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
|
|
|
|
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
|
|
|
|
:100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
|
|
|
|
EOF
|
2007-07-03 07:52:14 +02:00
|
|
|
git diff-tree -M -r master branch >actual
|
2007-01-18 19:26:24 +01:00
|
|
|
test_expect_success \
|
|
|
|
'C: validate rename result' \
|
|
|
|
'compare_diff_raw expect actual'
|
|
|
|
|
2007-01-18 21:17:58 +01:00
|
|
|
###
|
|
|
|
### 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 &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git whatchanged branch'
|
2007-01-18 21:17:58 +01:00
|
|
|
test_expect_success \
|
|
|
|
'D: verify pack' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
|
2007-01-18 21:17:58 +01:00
|
|
|
|
|
|
|
cat >expect <<EOF
|
|
|
|
:000000 100755 0000000000000000000000000000000000000000 35a59026a33beac1569b1c7f66f3090ce9c09afc A newdir/exec.sh
|
|
|
|
:000000 100644 0000000000000000000000000000000000000000 046d0371e9220107917db0d0e030628de8a1de9b A newdir/interesting
|
|
|
|
EOF
|
2007-07-03 07:52:14 +02:00
|
|
|
git diff-tree -M -r branch^ branch >actual
|
2007-01-18 21:17:58 +01:00
|
|
|
test_expect_success \
|
|
|
|
'D: validate new files added' \
|
|
|
|
'compare_diff_raw expect actual'
|
|
|
|
|
|
|
|
echo "$file5_data" >expect
|
|
|
|
test_expect_success \
|
|
|
|
'D: verify file5' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'git cat-file blob branch:newdir/interesting >actual &&
|
2007-02-25 23:36:53 +01:00
|
|
|
git diff expect actual'
|
2007-01-18 21:17:58 +01:00
|
|
|
|
|
|
|
echo "$file6_data" >expect
|
|
|
|
test_expect_success \
|
|
|
|
'D: verify file6' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'git cat-file blob branch:newdir/exec.sh >actual &&
|
2007-02-25 23:36:53 +01:00
|
|
|
git diff expect actual'
|
2007-01-18 21:17:58 +01:00
|
|
|
|
2007-02-06 20:58:30 +01:00
|
|
|
###
|
|
|
|
### series E
|
|
|
|
###
|
|
|
|
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/branch
|
|
|
|
author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500
|
|
|
|
data <<COMMIT
|
|
|
|
RFC 2822 type date
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/branch^0
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
test_expect_failure \
|
|
|
|
'E: rfc2822 date, --date-format=raw' \
|
|
|
|
'git-fast-import --date-format=raw <input'
|
|
|
|
test_expect_success \
|
|
|
|
'E: rfc2822 date, --date-format=rfc2822' \
|
|
|
|
'git-fast-import --date-format=rfc2822 <input'
|
|
|
|
test_expect_success \
|
|
|
|
'E: verify pack' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
|
2007-02-06 20:58:30 +01:00
|
|
|
|
|
|
|
cat >expect <<EOF
|
|
|
|
author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
|
|
|
|
|
|
|
|
RFC 2822 type date
|
|
|
|
EOF
|
|
|
|
test_expect_success \
|
|
|
|
'E: verify commit' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'git cat-file commit branch | sed 1,2d >actual &&
|
2007-02-25 23:36:53 +01:00
|
|
|
git diff expect actual'
|
2007-02-06 20:58:30 +01:00
|
|
|
|
2007-02-06 22:08:06 +01:00
|
|
|
###
|
|
|
|
### series F
|
|
|
|
###
|
|
|
|
|
2007-07-03 07:52:14 +02:00
|
|
|
old_branch=`git rev-parse --verify branch^0`
|
2007-02-06 22:08:06 +01:00
|
|
|
test_tick
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/branch
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
losing things already?
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/branch~1
|
|
|
|
|
|
|
|
reset refs/heads/other
|
|
|
|
from refs/heads/branch
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
test_expect_success \
|
|
|
|
'F: non-fast-forward update skips' \
|
|
|
|
'if git-fast-import <input
|
|
|
|
then
|
|
|
|
echo BAD gfi did not fail
|
|
|
|
return 1
|
|
|
|
else
|
2007-07-03 07:52:14 +02:00
|
|
|
if test $old_branch = `git rev-parse --verify branch^0`
|
2007-02-06 22:08:06 +01:00
|
|
|
then
|
|
|
|
: branch unaffected and failure returned
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
echo BAD gfi changed branch $old_branch
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
'
|
|
|
|
test_expect_success \
|
|
|
|
'F: verify pack' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
|
2007-02-06 22:08:06 +01:00
|
|
|
|
|
|
|
cat >expect <<EOF
|
2007-07-03 07:52:14 +02:00
|
|
|
tree `git rev-parse branch~1^{tree}`
|
|
|
|
parent `git rev-parse branch~1`
|
2007-02-06 22:08:06 +01:00
|
|
|
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
|
|
|
|
losing things already?
|
|
|
|
EOF
|
|
|
|
test_expect_success \
|
|
|
|
'F: verify other commit' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'git cat-file commit other >actual &&
|
2007-02-25 23:36:53 +01:00
|
|
|
git diff expect actual'
|
2007-02-06 22:08:06 +01:00
|
|
|
|
|
|
|
###
|
|
|
|
### series G
|
|
|
|
###
|
|
|
|
|
2007-07-03 07:52:14 +02:00
|
|
|
old_branch=`git rev-parse --verify branch^0`
|
2007-02-06 22:08:06 +01:00
|
|
|
test_tick
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/branch
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
losing things already?
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/branch~1
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
test_expect_success \
|
|
|
|
'G: non-fast-forward update forced' \
|
|
|
|
'git-fast-import --force <input'
|
|
|
|
test_expect_success \
|
|
|
|
'G: verify pack' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
|
2007-02-06 22:08:06 +01:00
|
|
|
test_expect_success \
|
|
|
|
'G: branch changed, but logged' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'test $old_branch != `git rev-parse --verify branch^0` &&
|
|
|
|
test $old_branch = `git rev-parse --verify branch@{1}`'
|
2007-02-06 22:08:06 +01:00
|
|
|
|
2007-02-07 08:03:03 +01:00
|
|
|
###
|
|
|
|
### series H
|
|
|
|
###
|
|
|
|
|
|
|
|
test_tick
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/H
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
third
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/branch^0
|
|
|
|
M 644 inline i-will-die
|
|
|
|
data <<EOF
|
|
|
|
this file will never exist.
|
|
|
|
EOF
|
|
|
|
|
|
|
|
deleteall
|
|
|
|
M 644 inline h/e/l/lo
|
|
|
|
data <<EOF
|
|
|
|
$file5_data
|
|
|
|
EOF
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
test_expect_success \
|
|
|
|
'H: deletall, add 1' \
|
|
|
|
'git-fast-import <input &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git whatchanged H'
|
2007-02-07 08:03:03 +01:00
|
|
|
test_expect_success \
|
|
|
|
'H: verify pack' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'
|
2007-02-07 08:03:03 +01:00
|
|
|
|
|
|
|
cat >expect <<EOF
|
|
|
|
:100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf
|
|
|
|
:100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf
|
|
|
|
:100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4
|
|
|
|
:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting h/e/l/lo
|
|
|
|
:100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh
|
|
|
|
EOF
|
2007-07-03 07:52:14 +02:00
|
|
|
git diff-tree -M -r H^ H >actual
|
2007-02-07 08:03:03 +01:00
|
|
|
test_expect_success \
|
|
|
|
'H: validate old files removed, new files added' \
|
|
|
|
'compare_diff_raw expect actual'
|
|
|
|
|
|
|
|
echo "$file5_data" >expect
|
|
|
|
test_expect_success \
|
|
|
|
'H: verify file' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'git cat-file blob H:h/e/l/lo >actual &&
|
2007-02-25 23:36:53 +01:00
|
|
|
git diff expect actual'
|
2007-02-07 08:03:03 +01:00
|
|
|
|
2007-02-12 01:45:56 +01:00
|
|
|
###
|
|
|
|
### series I
|
|
|
|
###
|
|
|
|
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/export-boundary
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
we have a border. its only 40 characters wide.
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/branch
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
test_expect_success \
|
|
|
|
'I: export-pack-edges' \
|
|
|
|
'git-fast-import --export-pack-edges=edges.list <input'
|
|
|
|
|
|
|
|
cat >expect <<EOF
|
2007-07-03 07:52:14 +02:00
|
|
|
.git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`
|
2007-02-12 01:45:56 +01:00
|
|
|
EOF
|
|
|
|
test_expect_success \
|
|
|
|
'I: verify edge list' \
|
|
|
|
'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
|
2007-02-25 23:36:53 +01:00
|
|
|
git diff expect actual'
|
2007-02-12 01:45:56 +01:00
|
|
|
|
2007-02-12 10:08:43 +01:00
|
|
|
###
|
|
|
|
### series J
|
|
|
|
###
|
|
|
|
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/J
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
create J
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/branch
|
|
|
|
|
|
|
|
reset refs/heads/J
|
|
|
|
|
|
|
|
commit refs/heads/J
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
initialize J
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
test_expect_success \
|
|
|
|
'J: reset existing branch creates empty commit' \
|
|
|
|
'git-fast-import <input'
|
|
|
|
test_expect_success \
|
|
|
|
'J: branch has 1 commit, empty tree' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'test 1 = `git rev-list J | wc -l` &&
|
2007-02-12 10:08:43 +01:00
|
|
|
test 0 = `git ls-tree J | wc -l`'
|
|
|
|
|
|
|
|
###
|
|
|
|
### series K
|
|
|
|
###
|
|
|
|
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/K
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
create K
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/branch
|
|
|
|
|
|
|
|
commit refs/heads/K
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
redo K
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/branch^1
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
test_expect_success \
|
|
|
|
'K: reinit branch with from' \
|
|
|
|
'git-fast-import <input'
|
|
|
|
test_expect_success \
|
|
|
|
'K: verify K^1 = branch^1' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'test `git rev-parse --verify branch^1` \
|
|
|
|
= `git rev-parse --verify K^1`'
|
2007-02-12 10:08:43 +01:00
|
|
|
|
2007-03-12 19:58:50 +01:00
|
|
|
###
|
|
|
|
### series L
|
|
|
|
###
|
|
|
|
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
blob
|
|
|
|
mark :1
|
|
|
|
data <<EOF
|
|
|
|
some data
|
|
|
|
EOF
|
|
|
|
|
|
|
|
blob
|
|
|
|
mark :2
|
|
|
|
data <<EOF
|
|
|
|
other data
|
|
|
|
EOF
|
|
|
|
|
|
|
|
commit refs/heads/L
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
create L
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
M 644 :1 b.
|
|
|
|
M 644 :1 b/other
|
|
|
|
M 644 :1 ba
|
|
|
|
|
|
|
|
commit refs/heads/L
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
update L
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
M 644 :2 b.
|
|
|
|
M 644 :2 b/other
|
|
|
|
M 644 :2 ba
|
|
|
|
INPUT_END
|
|
|
|
|
|
|
|
cat >expect <<EXPECT_END
|
|
|
|
:100644 100644 4268632... 55d3a52... M b.
|
|
|
|
:040000 040000 0ae5cac... 443c768... M b
|
|
|
|
:100644 100644 4268632... 55d3a52... M ba
|
|
|
|
EXPECT_END
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'L: verify internal tree sorting' \
|
|
|
|
'git-fast-import <input &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git diff --raw L^ L >output &&
|
2007-03-12 19:58:50 +01:00
|
|
|
git diff expect output'
|
|
|
|
|
2007-07-10 04:58:23 +02:00
|
|
|
###
|
|
|
|
### series M
|
|
|
|
###
|
|
|
|
|
|
|
|
test_tick
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/M1
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
file rename
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/branch^0
|
|
|
|
R file2/newf file2/n.e.w.f
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
|
|
|
|
cat >expect <<EOF
|
|
|
|
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
|
|
|
|
EOF
|
|
|
|
test_expect_success \
|
|
|
|
'M: rename file in same subdirectory' \
|
|
|
|
'git-fast-import <input &&
|
|
|
|
git diff-tree -M -r M1^ M1 >actual &&
|
|
|
|
compare_diff_raw expect actual'
|
|
|
|
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/M2
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
file rename
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/branch^0
|
|
|
|
R file2/newf i/am/new/to/you
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
|
|
|
|
cat >expect <<EOF
|
|
|
|
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
|
|
|
|
EOF
|
|
|
|
test_expect_success \
|
|
|
|
'M: rename file to new subdirectory' \
|
|
|
|
'git-fast-import <input &&
|
|
|
|
git diff-tree -M -r M2^ M2 >actual &&
|
|
|
|
compare_diff_raw expect actual'
|
|
|
|
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/M3
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
file rename
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/M2^0
|
|
|
|
R i other/sub
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
|
|
|
|
cat >expect <<EOF
|
|
|
|
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
|
|
|
|
EOF
|
|
|
|
test_expect_success \
|
|
|
|
'M: rename subdirectory to new subdirectory' \
|
|
|
|
'git-fast-import <input &&
|
|
|
|
git diff-tree -M -r M3^ M3 >actual &&
|
|
|
|
compare_diff_raw expect actual'
|
|
|
|
|
2007-07-15 07:40:37 +02:00
|
|
|
###
|
|
|
|
### series N
|
|
|
|
###
|
|
|
|
|
|
|
|
test_tick
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/N1
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
file copy
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/branch^0
|
|
|
|
C file2/newf file2/n.e.w.f
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
|
|
|
|
cat >expect <<EOF
|
|
|
|
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
|
|
|
|
EOF
|
|
|
|
test_expect_success \
|
|
|
|
'N: copy file in same subdirectory' \
|
|
|
|
'git-fast-import <input &&
|
|
|
|
git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&
|
|
|
|
compare_diff_raw expect actual'
|
|
|
|
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/N2
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
clean directory copy
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/branch^0
|
|
|
|
C file2 file3
|
|
|
|
|
|
|
|
commit refs/heads/N2
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
modify directory copy
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
M 644 inline file3/file5
|
|
|
|
data <<EOF
|
|
|
|
$file5_data
|
|
|
|
EOF
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
|
|
|
|
cat >expect <<EOF
|
|
|
|
:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
|
|
|
|
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
|
|
|
|
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
|
|
|
|
EOF
|
|
|
|
test_expect_success \
|
|
|
|
'N: copy then modify subdirectory' \
|
|
|
|
'git-fast-import <input &&
|
|
|
|
git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&
|
|
|
|
compare_diff_raw expect actual'
|
|
|
|
|
|
|
|
cat >input <<INPUT_END
|
|
|
|
commit refs/heads/N3
|
|
|
|
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
|
|
|
|
data <<COMMIT
|
|
|
|
dirty directory copy
|
|
|
|
COMMIT
|
|
|
|
|
|
|
|
from refs/heads/branch^0
|
|
|
|
M 644 inline file2/file5
|
|
|
|
data <<EOF
|
|
|
|
$file5_data
|
|
|
|
EOF
|
|
|
|
|
|
|
|
C file2 file3
|
|
|
|
D file2/file5
|
|
|
|
|
|
|
|
INPUT_END
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'N: copy dirty subdirectory' \
|
|
|
|
'git-fast-import <input &&
|
|
|
|
test `git-rev-parse N2^{tree}` = `git-rev-parse N3^{tree}`'
|
|
|
|
|
2007-01-18 19:26:24 +01:00
|
|
|
test_done
|