(command.CommandList children: [ (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:USAGE) op: Equal rhs: {(DQ ('[-a] [-r] [-m] [-t] [-n] [-b <newname>] <name>'))} ) ] ) (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:LONG_USAGE) op: Equal rhs: { (DQ ('git-resurrect attempts to find traces of a branch tip\n') ('called <name>, and tries to resurrect it. Currently, the reflog is\n') ('searched for checkout messages, and with -r also merge messages. With\n') ('-m and -t, the history of all refs is scanned for Merge <name> into\n') ('other/Merge <other> into <name> (respectively) commit subjects, which\n') ("is rather slow but allows you to resurrect other people's topic\n") (branches.) ) } ) ] ) (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:OPTIONS_KEEPDASHDASH) op:Equal rhs:(word.Empty))] ) (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:OPTIONS_STUCKLONG) op:Equal rhs:(word.Empty))] ) (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:OPTIONS_SPEC) op: Equal rhs: { (DQ ('git resurrect ') ($ VSub_DollarName '$USAGE') ('\n') ('--\n') ('b,branch= save branch as <newname> instead of <name>\n') ('a,all same as -l -r -m -t\n') ('k,keep-going full rev-list scan (instead of first match)\n') ('l,reflog scan reflog for checkouts (enabled by default)\n') ('r,reflog-merges scan for merges recorded in reflog\n') ('m,merges scan for merges into other branches (slow)\n') ('t,merge-targets scan for merges of other branches into <name>\n') ("n,dry-run don't recreate the branch") ) } ) ] ) (C {(.)} {(git-sh-setup)}) (command.FuncDef name: search_reflog body: (command.BraceGroup children: [ (command.Simple words: [ {(sed)} {(-ne)} {(SQ <'s~^\\([^ ]*\\) .*\\tcheckout: moving from '>) (DQ ($ VSub_Number '$1')) (SQ <' .*~\\1~p'>) } ] redirects: [ (redir.Redir op: <Redir_Less '<'> fd: 16777215 arg_word: {(DQ ($ VSub_DollarName '$GIT_DIR')) (/logs/HEAD)} ) ] ) ] ) ) (command.FuncDef name: search_reflog_merges body: (command.BraceGroup children: [ (C {(git)} {(rev-parse)} { (word_part.CommandSub left_token: <Left_DollarParen '$('> command_list: (command.CommandList children: [ (command.Simple words: [ {(sed)} {(-ne)} {(SQ <'s~^[^ ]* \\([^ ]*\\) .*\\tmerge '>) (DQ ($ VSub_Number '$1')) (SQ <':.*~\\1^2~p'>) } ] redirects: [ (redir.Redir op: <Redir_Less '<'> fd: 16777215 arg_word: {(DQ ($ VSub_DollarName '$GIT_DIR')) (/logs/HEAD)} ) ] ) ] ) ) } ) ] ) ) (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:_x40) op: Equal rhs: {(DQ ('[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'))} ) ] ) (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:_x40) op: Equal rhs: { (DQ ($ VSub_DollarName '$_x40') ($ VSub_DollarName '$_x40') ($ VSub_DollarName '$_x40') ($ VSub_DollarName '$_x40') ($ VSub_DollarName '$_x40') ($ VSub_DollarName '$_x40') ($ VSub_DollarName '$_x40') ($ VSub_DollarName '$_x40') ) } ) ] ) (command.FuncDef name: search_merges body: (command.BraceGroup children: [ (command.Pipeline children: [ (C {(git)} {(rev-list)} {(--all)} {(--grep) (Lit_Other '=') (DQ ("Merge branch '") ($ VSub_Number '$1') ("'"))} {(--pretty) (Lit_Other '=') (tformat) (Lit_Other ':') (DQ ('%P %s'))} ) (C {(sed)} {(-ne)} { (DQ ('/^') ($ VSub_DollarName '$_x40') (' ') (Lit_Other '\\') ('(') ($ VSub_DollarName '$_x40') (Lit_Other '\\') (') Merge .*/ {s//') (Lit_Other '\\') ('1/p;') ($ VSub_DollarName '$early_exit') ('}') ) } ) ] negated: F ) ] ) ) (command.FuncDef name: search_merge_targets body: (command.BraceGroup children: [ (command.Pipeline children: [ (C {(git)} {(rev-list)} {(--all)} {(--grep) (Lit_Other '=') (DQ ("Merge branch '[^']*' into ") ($ VSub_DollarName '$branch') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\$'>) ) } {(--pretty) (Lit_Other '=') (tformat) (Lit_Other ':') (DQ ('%H %s'))} {(--all)} ) (C {(sed)} {(-ne)} { (DQ ('/^') (Lit_Other '\\') ('(') ($ VSub_DollarName '$_x40') (Lit_Other '\\') (') Merge .*/ {s//') (Lit_Other '\\') ('1/p;') ($ VSub_DollarName '$early_exit') ('} ') ) } ) ] negated: F ) ] ) ) (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:dry_run) op:Equal rhs:(word.Empty))] ) (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:early_exit) op:Equal rhs:{(q)})] ) (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:scan_reflog) op:Equal rhs:{(t)})] ) (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:scan_reflog_merges) op:Equal rhs:(word.Empty))] ) (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:scan_merges) op:Equal rhs:(word.Empty))] ) (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:scan_merge_targets) op:Equal rhs:(word.Empty))] ) (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:new_name) op:Equal rhs:(word.Empty))] ) (command.WhileUntil keyword: <KW_While while> cond: [ (command.Sentence child: (C {(test)} {(DQ ($ VSub_Pound '$#'))} {(KW_Bang '!') (Lit_Other '=')} {(0)}) terminator: <Op_Semi ';'> ) ] body: (command.DoGroup children: [ (command.Case to_match: {(DQ ($ VSub_Number '$1'))} arms: [ (case_arm pat_list: [{(-b)} {(--branch)}] action: [ (C {(shift)}) (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:new_name) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} ) ] ) ] ) (case_arm pat_list: [{(-n)} {(--dry-run)}] action: [ (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:dry_run) op:Equal rhs:{(t)})] ) ] ) (case_arm pat_list: [{(--no-dry-run)}] action: [ (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:dry_run) op:Equal rhs:(word.Empty))] ) ] ) (case_arm pat_list: [{(-k)} {(--keep-going)}] action: [ (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:early_exit) op:Equal rhs:(word.Empty))] ) ] ) (case_arm pat_list: [{(--no-keep-going)}] action: [ (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:early_exit) op:Equal rhs:{(q)})] ) ] ) (case_arm pat_list: [{(-m)} {(--merges)}] action: [ (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:scan_merges) op:Equal rhs:{(t)})] ) ] ) (case_arm pat_list: [{(--no-merges)}] action: [ (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:scan_merges) op:Equal rhs:(word.Empty))] ) ] ) (case_arm pat_list: [{(-l)} {(--reflog)}] action: [ (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:scan_reflog) op:Equal rhs:{(t)})] ) ] ) (case_arm pat_list: [{(--no-reflog)}] action: [ (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:scan_reflog) op:Equal rhs:(word.Empty))] ) ] ) (case_arm pat_list: [{(-r)} {(--reflog_merges)}] action: [ (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:scan_reflog_merges) op: Equal rhs: {(t)} ) ] ) ] ) (case_arm pat_list: [{(--no-reflog_merges)}] action: [ (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:scan_reflog_merges) op:Equal rhs:(word.Empty))] ) ] ) (case_arm pat_list: [{(-t)} {(--merge-targets)}] action: [ (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:scan_merge_targets) op: Equal rhs: {(t)} ) ] ) ] ) (case_arm pat_list: [{(--no-merge-targets)}] action: [ (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:scan_merge_targets) op:Equal rhs:(word.Empty))] ) ] ) (case_arm pat_list: [{(-a)} {(--all)}] action: [ (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:scan_reflog) op:Equal rhs:{(t)})] ) (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:scan_reflog_merges) op: Equal rhs: {(t)} ) ] ) (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:scan_merges) op:Equal rhs:{(t)})] ) (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:scan_merge_targets) op: Equal rhs: {(t)} ) ] ) ] ) (case_arm pat_list: [{(--)}] action: [(C {(shift)}) (command.ControlFlow token:<ControlFlow_Break break>)] ) (case_arm pat_list:[{(Lit_Star '*')}] action:[(C {(usage)})]) ] ) (C {(shift)}) ] ) ) (command.AndOr ops: [Op_DPipe] children: [(C {(test)} {(DQ ($ VSub_Pound '$#'))} {(Lit_Other '=')} {(1)}) (C {(usage)})] ) (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:all_strategies) op: Equal rhs: { (DQ ($ VSub_DollarName '$scan_reflog') ($ VSub_DollarName '$scan_reflog_merges') ($ VSub_DollarName '$scan_merges') ($ VSub_DollarName '$scan_merge_targets') ) } ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(test)} {(-z)} {(DQ ($ VSub_DollarName '$all_strategies'))}) terminator: <Op_Semi ';'> ) ] action: [(C {(die)} {(DQ ('must enable at least one of -lrmt'))})] ) ] ) (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:branch) op:Equal rhs:{(DQ ($ VSub_Number '$1'))})] ) (command.AndOr ops: [Op_DAmp] children: [ (C {(test)} {(-z)} {(DQ ($ VSub_DollarName '$new_name'))}) (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:new_name) op: Equal rhs: {(DQ ($ VSub_DollarName '$branch'))} ) ] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(test)} {(KW_Bang '!')} {(-z)} {(DQ ($ VSub_DollarName '$scan_reflog'))}) terminator: <Op_Semi ';'> ) ] action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(test)} {(-r)} {(DQ ($ VSub_DollarName '$GIT_DIR')) (/logs/HEAD)}) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:candidates) op: Equal rhs: { (DQ (word_part.CommandSub left_token: <Left_DollarParen '$('> command_list: (command.CommandList children: [(C {(search_reflog)} {($ VSub_DollarName '$branch')})] ) ) ) } ) ] ) ] ) ] else_action: [ (C {(die)} {(SQ <'reflog scanning requested, but'>)} {(SQ <'$GIT_DIR/logs/HEAD not readable'>)} ) ] ) ] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(test)} {(KW_Bang '!')} {(-z)} {(DQ ($ VSub_DollarName '$scan_reflog_merges'))}) terminator: <Op_Semi ';'> ) ] action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(test)} {(-r)} {(DQ ($ VSub_DollarName '$GIT_DIR')) (/logs/HEAD)}) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:candidates) op: Equal rhs: { (DQ ($ VSub_DollarName '$candidates') (' ') (word_part.CommandSub left_token: <Left_DollarParen '$('> command_list: (command.CommandList children: [ (C {(search_reflog_merges)} {($ VSub_DollarName '$branch')}) ] ) ) ) } ) ] ) ] ) ] else_action: [ (C {(die)} {(SQ <'reflog scanning requested, but'>)} {(SQ <'$GIT_DIR/logs/HEAD not readable'>)} ) ] ) ] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(test)} {(KW_Bang '!')} {(-z)} {(DQ ($ VSub_DollarName '$scan_merges'))}) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:candidates) op: Equal rhs: { (DQ ($ VSub_DollarName '$candidates') (' ') (word_part.CommandSub left_token: <Left_DollarParen '$('> command_list: (command.CommandList children: [(C {(search_merges)} {($ VSub_DollarName '$branch')})] ) ) ) } ) ] ) ] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(test)} {(KW_Bang '!')} {(-z)} {(DQ ($ VSub_DollarName '$scan_merge_targets'))}) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:candidates) op: Equal rhs: { (DQ ($ VSub_DollarName '$candidates') (' ') (word_part.CommandSub left_token: <Left_DollarParen '$('> command_list: (command.CommandList children: [(C {(search_merge_targets)} {($ VSub_DollarName '$branch')})] ) ) ) } ) ] ) ] ) ] ) (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:candidates) op: Equal rhs: { (DQ (word_part.CommandSub left_token: <Left_DollarParen '$('> command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(git)} {(rev-parse)} {($ VSub_DollarName '$candidates')}) (C {(sort)} {(-u)}) ] negated: F ) ] ) ) ) } ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(test)} {(-z)} {(DQ ($ VSub_DollarName '$candidates'))}) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment pairs: [(assign_pair lhs:(lhs_expr.LhsName name:hint) op:Equal rhs:(word.Empty))] ) (command.AndOr ops: [Op_DAmp] children: [ (C {(test)} {(DQ (z) ($ VSub_DollarName '$all_strategies'))} {(KW_Bang '!') (Lit_Other '=')} {(DQ (ztttt))} ) (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:hint) op: Equal rhs: {(DQ (' (maybe try again with -a)'))} ) ] ) ] ) (C {(die)} { (DQ ('no candidates for ') ($ VSub_DollarName '$branch') (' found') ($ VSub_DollarName '$hint') ) } ) ] ) ] ) (C {(echo)} {(DQ ('** Candidates for ') ($ VSub_DollarName '$branch') (' **'))}) (command.Pipeline children: [ (command.ForEach iter_name: cmt iter_words: [{($ VSub_DollarName '$candidates')}] do_arg_iter: F body: (command.DoGroup children: [ (C {(git)} {(--no-pager)} {(log)} {(--pretty) (Lit_Other '=') (tformat) (Lit_Other ':') (DQ ('%ct:%h [%cr] %s'))} {(--abbrev-commit)} {(-1)} {($ VSub_DollarName '$cmt')} ) ] ) ) (C {(sort)} {(-n)}) (C {(cut)} {(-d) (Lit_Other ':')} {(-f2-)}) ] negated: F ) (command.Assignment pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:newest) op: Equal rhs: { (DQ (word_part.CommandSub left_token: <Left_DollarParen '$('> command_list: (command.CommandList children: [(C {(git)} {(rev-list)} {(-1)} {($ VSub_DollarName '$candidates')})] ) ) ) } ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(test)} {(KW_Bang '!')} {(-z)} {(DQ ($ VSub_DollarName '$dry_run'))}) terminator: <Op_Semi ';'> ) ] action: [ (C {(printf)} {(DQ ('** Most recent: '))}) (C {(git)} {(--no-pager)} {(log)} {(-1)} {(--pretty) (Lit_Other '=') (tformat) (Lit_Other ':') (DQ ('%h %s'))} {($ VSub_DollarName '$newest')} ) ] ) (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [ (command.Simple words: [ {(git)} {(rev-parse)} {(--verify)} {(--quiet)} {($ VSub_DollarName '$new_name')} ] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) ] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (C {(printf)} {(DQ ('** Restoring ') ($ VSub_DollarName '$new_name') (' to '))}) (C {(git)} {(--no-pager)} {(log)} {(-1)} {(--pretty) (Lit_Other '=') (tformat) (Lit_Other ':') (DQ ('%h %s'))} {($ VSub_DollarName '$newest')} ) (C {(git)} {(branch)} {($ VSub_DollarName '$new_name')} {($ VSub_DollarName '$newest')}) ] ) ] else_action: [ (C {(printf)} {(DQ ('Most recent: '))}) (C {(git)} {(--no-pager)} {(log)} {(-1)} {(--pretty) (Lit_Other '=') (tformat) (Lit_Other ':') (DQ ('%h %s'))} {($ VSub_DollarName '$newest')} ) (C {(echo)} {(DQ ('** ') ($ VSub_DollarName '$new_name') (' already exists, doing nothing'))}) ] ) ] )