Skip to content

Commit 8d30d8a

Browse files
satorigitster
authored andcommitted
t9300: test filedelete command
Add new fast-import test series for filedelete command. Signed-off-by: Maxim Bublis <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4109c28 commit 8d30d8a

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

t/t9300-fast-import.sh

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3017,4 +3017,108 @@ test_expect_success 'T: empty reset doesnt delete branch' '
30173017
git rev-parse --verify refs/heads/not-to-delete
30183018
'
30193019

3020+
###
3021+
### series U (filedelete)
3022+
###
3023+
3024+
cat >input <<INPUT_END
3025+
commit refs/heads/U
3026+
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3027+
data <<COMMIT
3028+
test setup
3029+
COMMIT
3030+
M 100644 inline hello.c
3031+
data <<BLOB
3032+
blob 1
3033+
BLOB
3034+
M 100644 inline good/night.txt
3035+
data <<BLOB
3036+
sleep well
3037+
BLOB
3038+
M 100644 inline good/bye.txt
3039+
data <<BLOB
3040+
au revoir
3041+
BLOB
3042+
3043+
INPUT_END
3044+
3045+
test_expect_success 'U: initialize for U tests' '
3046+
git fast-import <input
3047+
'
3048+
3049+
cat >input <<INPUT_END
3050+
commit refs/heads/U
3051+
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3052+
data <<COMMIT
3053+
delete good/night.txt
3054+
COMMIT
3055+
from refs/heads/U^0
3056+
D good/night.txt
3057+
3058+
INPUT_END
3059+
3060+
test_expect_success 'U: filedelete file succeeds' '
3061+
git fast-import <input
3062+
'
3063+
3064+
cat >expect <<EOF
3065+
:100644 000000 2907ebb4bf85d91bf0716bb3bd8a68ef48d6da76 0000000000000000000000000000000000000000 D good/night.txt
3066+
EOF
3067+
3068+
git diff-tree -M -r U^1 U >actual
3069+
3070+
test_expect_success 'U: validate file delete result' '
3071+
compare_diff_raw expect actual
3072+
'
3073+
3074+
cat >input <<INPUT_END
3075+
commit refs/heads/U
3076+
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3077+
data <<COMMIT
3078+
delete good dir
3079+
COMMIT
3080+
from refs/heads/U^0
3081+
D good
3082+
3083+
INPUT_END
3084+
3085+
test_expect_success 'U: filedelete directory succeeds' '
3086+
git fast-import <input
3087+
'
3088+
3089+
cat >expect <<EOF
3090+
:100644 000000 69cb75792f55123d8389c156b0b41c2ff00ed507 0000000000000000000000000000000000000000 D good/bye.txt
3091+
EOF
3092+
3093+
git diff-tree -M -r U^1 U >actual
3094+
3095+
test_expect_success 'U: validate directory delete result' '
3096+
compare_diff_raw expect actual
3097+
'
3098+
3099+
cat >input <<INPUT_END
3100+
commit refs/heads/U
3101+
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3102+
data <<COMMIT
3103+
must succeed
3104+
COMMIT
3105+
from refs/heads/U^0
3106+
D ""
3107+
3108+
INPUT_END
3109+
3110+
test_expect_failure 'U: filedelete root succeeds' '
3111+
git fast-import <input
3112+
'
3113+
3114+
cat >expect <<EOF
3115+
:100644 000000 c18147dc648481eeb65dc5e66628429a64843327 0000000000000000000000000000000000000000 D hello.c
3116+
EOF
3117+
3118+
git diff-tree -M -r U^1 U >actual
3119+
3120+
test_expect_failure 'U: validate root delete result' '
3121+
compare_diff_raw expect actual
3122+
'
3123+
30203124
test_done

0 commit comments

Comments
 (0)