(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'Test reflog interaction with detached HEAD'>)} spids: [4] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: reset_state body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<git>} {<checkout>} {<master>}) (C {<cp>} {<saved_reflog>} {<'.git/logs/HEAD'>}) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\ttest_tick &&\n'> <'\tgit commit --allow-empty -m initial &&\n'> <'\tgit branch side &&\n'> <'\ttest_tick &&\n'> <'\tgit commit --allow-empty -m second &&\n'> <'\tcat .git/logs/HEAD >saved_reflog\n'> ) } ) (C {<test_expect_success>} {<baseline>} { (SQ <'\n'> <'\treset_state &&\n'> <'\tgit rev-parse master master^ >expect &&\n'> <'\tgit log -g --format=%H >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'switch to branch'>)} { (SQ <'\n'> <'\treset_state &&\n'> <'\tgit rev-parse side master master^ >expect &&\n'> <'\tgit checkout side &&\n'> <'\tgit log -g --format=%H >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'detach to other'>)} { (SQ <'\n'> <'\treset_state &&\n'> <'\tgit rev-parse master side master master^ >expect &&\n'> <'\tgit checkout side &&\n'> <'\tgit checkout master^0 &&\n'> <'\tgit log -g --format=%H >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'detach to self'>)} { (SQ <'\n'> <'\treset_state &&\n'> <'\tgit rev-parse master master master^ >expect &&\n'> <'\tgit checkout master^0 &&\n'> <'\tgit log -g --format=%H >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'attach to self'>)} { (SQ <'\n'> <'\treset_state &&\n'> <'\tgit rev-parse master master master master^ >expect &&\n'> <'\tgit checkout master^0 &&\n'> <'\tgit checkout master &&\n'> <'\tgit log -g --format=%H >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'attach to other'>)} { (SQ <'\n'> <'\treset_state &&\n'> <'\tgit rev-parse side master master master^ >expect &&\n'> <'\tgit checkout master^0 &&\n'> <'\tgit checkout side &&\n'> <'\tgit log -g --format=%H >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_done>}) ] )