3 test_description
='tg update --skip-missing branches'
11 uctmp
="$(test_get_temp update-check)" || die
13 branch_is_up_to_date
() {
14 needs_update_check
"$@" >"$uctmp" &&
16 read -r uc_processed
&&
21 test z
"$uc_behind" = z
":"
24 test_expect_success
'setup' '
25 test_create_repo pristine &&
27 git config core.logallrefupdates false &&
28 git checkout --orphan release &&
29 git read-tree --empty &&
31 test_commit "release~1" &&
32 tg_test_create_branches <<-EOT &&
33 t/patch1 [PATCH] alpha patch
36 t/patch2 [PATCH] beta patch
39 git checkout -f t/patch1 &&
40 test_commit "alpha~1" &&
41 tg_test_create_branch t/int -m "[INTERMEDIATE] extra level" t/patch2 &&
42 git checkout -f t/patch2 &&
43 test_commit "beta~1" &&
44 tg_test_create_branch stage -m "[STAGE] staging branch" release t/patch1 t/int &&
45 test_must_fail branch_is_up_to_date stage &&
47 git prune --expire=now &&
48 git pack-refs --prune --all &&
49 test_when_finished test_tick=$test_tick &&
50 test_when_finished test_set_prereq SETUP
53 test_expect_success SETUP
'tg update succeeds with nothing missing' '
54 cp -pR pristine succeeds &&
56 tg update --no-stash stage &&
57 branch_is_up_to_date stage
60 test_expect_success SETUP
'tg update fails with missing dependency' '
61 cp -pR pristine fails &&
63 git checkout -f stage &&
64 git branch -M t/patch2 t-missing/patch2 &&
65 test_must_fail tg update --no-stash stage
68 test_expect_success SETUP
,LASTOK
'tg update --skip-missing succeeds with missing dependency' '
70 test_might_fail tg update --abort >/dev/null 2>&1 &&
71 git checkout -f stage &&
72 tg update --no-stash --skip-missing stage
75 test_expect_success SETUP
,LASTOK
'branch up-to-date with missing depedency' '
77 git checkout -f stage &&
78 branch_is_up_to_date stage
81 test_expect_success SETUP
,LASTOK
'branch out of date after restoring branch' '
83 git checkout -f stage &&
84 git branch -M t-missing/patch2 t/patch2 &&
85 test_must_fail branch_is_up_to_date stage
88 test_expect_success SETUP
,LASTOK
'tg update finally succeeds completely' '
90 git checkout -f stage &&
91 tg update --no-stash stage &&
92 branch_is_up_to_date stage