(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:USAGE) op: assign_op.Equal rhs: {(DQ <'[-a] [-r] [-m] [-t] [-n] [-b <newname>] <name>'>)} spids: [4] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:LONG_USAGE) op: assign_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.> ) } spids: [9] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:OPTIONS_KEEPDASHDASH) op: assign_op.Equal rhs: (word.Empty) spids: [21] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:OPTIONS_STUCKLONG) op: assign_op.Equal rhs: (word.Empty) spids: [23] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:OPTIONS_SPEC) op: assign_op.Equal rhs: { (DQ <'git resurrect '> ($ Id.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'> ) } spids: [25] ) ] ) (C {<.>} {<git-sh-setup>}) (command.ShFunction name: search_reflog body: (BraceGroup children: [ (command.Simple words: [ {<sed>} {<-ne>} {(SQ <'s~^\\([^ ]*\\) .*\\tcheckout: moving from '>) (DQ ($ Id.VSub_Number '$1')) (SQ <' .*~\\1~p'>) } ] redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {(DQ ($ Id.VSub_DollarName '$GIT_DIR')) <'/logs/HEAD'>} ) ] do_fork: T ) ] ) ) (command.ShFunction name: search_reflog_merges body: (BraceGroup children: [ (C {<git>} {<rev-parse>} { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Simple words: [ {<sed>} {<-ne>} {(SQ <'s~^[^ ]* \\([^ ]*\\) .*\\tmerge '>) (DQ ($ Id.VSub_Number '$1')) (SQ <':.*~\\1^2~p'>) } ] redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {(DQ ($ Id.VSub_DollarName '$GIT_DIR')) <'/logs/HEAD'>} ) ] do_fork: T ) ) } ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:_x40) op: assign_op.Equal rhs: {(DQ <'[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'>)} spids: [126] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:_x40) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName '$_x40') ($ Id.VSub_DollarName '$_x40') ($ Id.VSub_DollarName '$_x40') ($ Id.VSub_DollarName '$_x40') ($ Id.VSub_DollarName '$_x40') ($ Id.VSub_DollarName '$_x40') ($ Id.VSub_DollarName '$_x40') ($ Id.VSub_DollarName '$_x40') ) } spids: [131] ) ] ) (command.ShFunction name: search_merges body: (BraceGroup children: [ (command.Pipeline children: [ (C {<git>} {<rev-list>} {<--all>} {<--grep> <Id.Lit_Equals '='> (DQ <'Merge branch \''> ($ Id.VSub_Number '$1') <'\''>)} {<--pretty> <Id.Lit_Equals '='> <tformat> <Id.Lit_Colon ':'> (DQ <'%P %s'>)} ) (C {<sed>} {<-ne>} { (DQ <'/^'> ($ Id.VSub_DollarName '$_x40') <' '> <Id.Lit_BadBackslash '\\'> <'('> ($ Id.VSub_DollarName '$_x40') <Id.Lit_BadBackslash '\\'> <') Merge .*/ {s//'> <Id.Lit_BadBackslash '\\'> <'1/p;'> ($ Id.VSub_DollarName '$early_exit') <'}'> ) } ) ] negated: F ) ] ) ) (command.ShFunction name: search_merge_targets body: (BraceGroup children: [ (command.Pipeline children: [ (C {<git>} {<rev-list>} {<--all>} {<--grep> <Id.Lit_Equals '='> (DQ <'Merge branch \'[^\']*\' into '> ($ Id.VSub_DollarName '$branch') (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\$'> ) ) } {<--pretty> <Id.Lit_Equals '='> <tformat> <Id.Lit_Colon ':'> (DQ <'%H %s'>)} {<--all>} ) (C {<sed>} {<-ne>} { (DQ <'/^'> <Id.Lit_BadBackslash '\\'> <'('> ($ Id.VSub_DollarName '$_x40') <Id.Lit_BadBackslash '\\'> <') Merge .*/ {s//'> <Id.Lit_BadBackslash '\\'> <'1/p;'> ($ Id.VSub_DollarName '$early_exit') <'} '> ) } ) ] negated: F ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:dry_run) op: assign_op.Equal rhs: (word.Empty) spids: [258] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:early_exit) op: assign_op.Equal rhs: {<q>} spids: [260] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_reflog) op: assign_op.Equal rhs: {<t>} spids: [263] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_reflog_merges) op: assign_op.Equal rhs: (word.Empty) spids: [266] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_merges) op: assign_op.Equal rhs: (word.Empty) spids: [268] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_merge_targets) op: assign_op.Equal rhs: (word.Empty) spids: [270] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:new_name) op: assign_op.Equal rhs: (word.Empty) spids: [272] ) ] ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {(DQ ($ Id.VSub_Pound '$#'))} {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<0>}) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup children: [ (command.Case to_match: {(DQ ($ Id.VSub_Number '$1'))} arms: [ (case_arm pat_list: [{<-b>} {<--branch>}] action: [ (C {<shift>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:new_name) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [310] ) ] ) ] spids: [301 304 316 -1] ) (case_arm pat_list: [{<-n>} {<--dry-run>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:dry_run) op: assign_op.Equal rhs: {<t>} spids: [325] ) ] ) ] spids: [319 322 329 -1] ) (case_arm pat_list: [{<--no-dry-run>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:dry_run) op: assign_op.Equal rhs: (word.Empty) spids: [336] ) ] ) ] spids: [332 333 339 -1] ) (case_arm pat_list: [{<-k>} {<--keep-going>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:early_exit) op: assign_op.Equal rhs: (word.Empty) spids: [348] ) ] ) ] spids: [342 345 351 -1] ) (case_arm pat_list: [{<--no-keep-going>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:early_exit) op: assign_op.Equal rhs: {<q>} spids: [358] ) ] ) ] spids: [354 355 362 -1] ) (case_arm pat_list: [{<-m>} {<--merges>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_merges) op: assign_op.Equal rhs: {<t>} spids: [371] ) ] ) ] spids: [365 368 375 -1] ) (case_arm pat_list: [{<--no-merges>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_merges) op: assign_op.Equal rhs: (word.Empty) spids: [382] ) ] ) ] spids: [378 379 385 -1] ) (case_arm pat_list: [{<-l>} {<--reflog>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_reflog) op: assign_op.Equal rhs: {<t>} spids: [394] ) ] ) ] spids: [388 391 398 -1] ) (case_arm pat_list: [{<--no-reflog>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_reflog) op: assign_op.Equal rhs: (word.Empty) spids: [405] ) ] ) ] spids: [401 402 408 -1] ) (case_arm pat_list: [{<-r>} {<--reflog_merges>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_reflog_merges) op: assign_op.Equal rhs: {<t>} spids: [417] ) ] ) ] spids: [411 414 421 -1] ) (case_arm pat_list: [{<--no-reflog_merges>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_reflog_merges) op: assign_op.Equal rhs: (word.Empty) spids: [428] ) ] ) ] spids: [424 425 431 -1] ) (case_arm pat_list: [{<-t>} {<--merge-targets>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_merge_targets) op: assign_op.Equal rhs: {<t>} spids: [440] ) ] ) ] spids: [434 437 444 -1] ) (case_arm pat_list: [{<--no-merge-targets>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_merge_targets) op: assign_op.Equal rhs: (word.Empty) spids: [451] ) ] ) ] spids: [447 448 454 -1] ) (case_arm pat_list: [{<-a>} {<--all>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_reflog) op: assign_op.Equal rhs: {<t>} spids: [463] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_reflog_merges) op: assign_op.Equal rhs: {<t>} spids: [467] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_merges) op: assign_op.Equal rhs: {<t>} spids: [471] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scan_merge_targets) op: assign_op.Equal rhs: {<t>} spids: [475] ) ] ) ] spids: [457 460 479 -1] ) (case_arm pat_list: [{<-->}] action: [(C {<shift>}) (command.ControlFlow token:<Id.ControlFlow_Break break>)] spids: [482 483 492 -1] ) (case_arm pat_list: [{<Id.Lit_Star '*'>}] action: [(C {<usage>})] spids: [495 496 502 -1] ) ] ) (C {<shift>}) ] ) ) (command.AndOr ops: [Id.Op_DPipe] children: [(C {<test>} {(DQ ($ Id.VSub_Pound '$#'))} {<Id.Lit_Equals '='>} {<1>}) (C {<usage>})] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:all_strategies) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName '$scan_reflog') ($ Id.VSub_DollarName '$scan_reflog_merges') ($ Id.VSub_DollarName '$scan_merges') ($ Id.VSub_DollarName '$scan_merge_targets') ) } spids: [528] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<-z>} {(DQ ($ Id.VSub_DollarName '$all_strategies'))}) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<die>} {(DQ <'must enable at least one of -lrmt'>)})] spids: [536 547] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:branch) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [559] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<test>} {<-z>} {(DQ ($ Id.VSub_DollarName '$new_name'))}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:new_name) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$branch'))} spids: [574] ) ] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<Id.KW_Bang '!'>} {<-z>} {(DQ ($ Id.VSub_DollarName '$scan_reflog'))}) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<-r>} {(DQ ($ Id.VSub_DollarName '$GIT_DIR')) <'/logs/HEAD'>}) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:candidates) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<search_reflog>} {($ Id.VSub_DollarName '$branch')}) ) ) } spids: [611] ) ] ) ] spids: [596 608] ) ] else_action: [ (C {<die>} {(SQ <'reflog scanning requested, but'>)} {(SQ <'$GIT_DIR/logs/HEAD not readable'>)} ) ] ) ] spids: [580 593] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<Id.KW_Bang '!'>} {<-z>} {(DQ ($ Id.VSub_DollarName '$scan_reflog_merges'))} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<-r>} {(DQ ($ Id.VSub_DollarName '$GIT_DIR')) <'/logs/HEAD'>}) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:candidates) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName '$candidates') <' '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<search_reflog_merges>} {($ Id.VSub_DollarName '$branch')}) ) ) } spids: [672] ) ] ) ] spids: [657 669] ) ] else_action: [ (C {<die>} {(SQ <'reflog scanning requested, but'>)} {(SQ <'$GIT_DIR/logs/HEAD not readable'>)} ) ] ) ] spids: [641 654] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<Id.KW_Bang '!'>} {<-z>} {(DQ ($ Id.VSub_DollarName '$scan_merges'))}) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:candidates) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName '$candidates') <' '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<search_merges>} {($ Id.VSub_DollarName '$branch')}) ) ) } spids: [720] ) ] ) ] spids: [704 717] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<Id.KW_Bang '!'>} {<-z>} {(DQ ($ Id.VSub_DollarName '$scan_merge_targets'))} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:candidates) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName '$candidates') <' '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<search_merge_targets>} {($ Id.VSub_DollarName '$branch')}) ) ) } spids: [749] ) ] ) ] spids: [733 746] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:candidates) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<git>} {<rev-parse>} {($ Id.VSub_DollarName '$candidates')}) (C {<sort>} {<-u>}) ] negated: F ) ) ) } spids: [763] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<-z>} {(DQ ($ Id.VSub_DollarName '$candidates'))}) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:hint) op: assign_op.Equal rhs: (word.Empty) spids: [795] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<test>} {(DQ <z> ($ Id.VSub_DollarName '$all_strategies'))} {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ <ztttt>)} ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:hint) op: assign_op.Equal rhs: {(DQ <' (maybe try again with -a)'>)} spids: [816] ) ] ) ] ) (C {<die>} { (DQ <'no candidates for '> ($ Id.VSub_DollarName '$branch') <' found'> ($ Id.VSub_DollarName '$hint') ) } ) ] spids: [781 792] ) ] ) (C {<echo>} {(DQ <'** Candidates for '> ($ Id.VSub_DollarName '$branch') <' **'>)}) (command.Pipeline children: [ (command.ForEach iter_name: cmt iter_words: [{($ Id.VSub_DollarName '$candidates')}] do_arg_iter: F body: (command.DoGroup children: [ (C {<git>} {<--no-pager>} {<log>} {<--pretty> <Id.Lit_Equals '='> <tformat> <Id.Lit_Colon ':'> (DQ <'%ct:%h [%cr] %s'>)} {<--abbrev-commit>} {<-1>} {($ Id.VSub_DollarName '$cmt')} ) ] ) ) (C {<sort>} {<-n>}) (C {<cut>} {<-d> <Id.Lit_Colon ':'>} {<-f2->}) ] negated: F ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:newest) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<rev-list>} {<-1>} {($ Id.VSub_DollarName '$candidates')}) ) ) } spids: [893] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<Id.KW_Bang '!'>} {<-z>} {(DQ ($ Id.VSub_DollarName '$dry_run'))}) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<printf>} {(DQ <'** Most recent: '>)}) (C {<git>} {<--no-pager>} {<log>} {<-1>} {<--pretty> <Id.Lit_Equals '='> <tformat> <Id.Lit_Colon ':'> (DQ <'%h %s'>)} {($ Id.VSub_DollarName '$newest')} ) ] spids: [906 919] ) (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Pipeline children: [ (command.Simple words: [ {<git>} {<rev-parse>} {<--verify>} {<--quiet>} {($ Id.VSub_DollarName '$new_name')} ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) ] negated: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<printf>} {(DQ <'** Restoring '> ($ Id.VSub_DollarName '$new_name') <' to '>)}) (C {<git>} {<--no-pager>} {<log>} {<-1>} {<--pretty> <Id.Lit_Equals '='> <tformat> <Id.Lit_Colon ':'> (DQ <'%h %s'>)} {($ Id.VSub_DollarName '$newest')} ) (C {<git>} {<branch>} {($ Id.VSub_DollarName '$new_name')} {($ Id.VSub_DollarName '$newest')}) ] spids: [947 965] ) ] else_action: [ (C {<printf>} {(DQ <'Most recent: '>)}) (C {<git>} {<--no-pager>} {<log>} {<-1>} {<--pretty> <Id.Lit_Equals '='> <tformat> <Id.Lit_Colon ':'> (DQ <'%h %s'>)} {($ Id.VSub_DollarName '$newest')} ) (C {<echo>} {(DQ <'** '> ($ Id.VSub_DollarName '$new_name') <' already exists, doing nothing'>)}) ] ) ] )