(List (= scope= flags=0 words=[] bindings=[('USAGE', {[DQ [LIT_CHARS "[-a] [-r] [-m] [-t] [-n] [-b ] "]]})]) (= scope= flags=0 words=[] bindings=[('LONG_USAGE', {[DQ [LIT_CHARS "git-resurrect attempts to find traces of a branch tip\n"][LIT_CHARS "called , and tries to resurrect it. Currently, the reflog is\n"][LIT_CHARS "searched for checkout messages, and with -r also merge messages. With\n"][LIT_CHARS "-m and -t, the history of all refs is scanned for Merge into\n"][LIT_CHARS "other/Merge into (respectively) commit subjects, which\n"][LIT_CHARS "is rather slow but allows you to resurrect other people's topic\n"][LIT_CHARS branches.]]})]) (= scope= flags=0 words=[] bindings=[('OPTIONS_KEEPDASHDASH', {[SQ ]})]) (= scope= flags=0 words=[] bindings=[('OPTIONS_SPEC', {[DQ [LIT_CHARS "git resurrect "][VarSub USAGE][LIT_CHARS "\n"][LIT_CHARS "--\n"][LIT_CHARS "b,branch= save branch as instead of \n"][LIT_CHARS "a,all same as -l -r -m -t\n"][LIT_CHARS "k,keep-going full rev-list scan (instead of first match)\n"][LIT_CHARS "l,reflog scan reflog for checkouts (enabled by default)\n"][LIT_CHARS "r,reflog-merges scan for merges recorded in reflog\n"][LIT_CHARS "m,merges scan for merges into other branches (slow)\n"][LIT_CHARS "t,merge-targets scan for merges of other branches into \n"][LIT_CHARS "n,dry-run don't recreate the branch"]]})]) (Com {[LIT_CHARS .]} {[LIT_CHARS git-sh-setup]} ) (FunctionDef search_reflog [] (Com {[LIT_CHARS sed]} {[LIT_CHARS -ne]} {[SQ ] [DQ [VarSub 1]] [SQ ]} < (FilenameRedirectNode filename={[DQ [VarSub GIT_DIR]] [LIT_CHARS /logs/HEAD]} 0), > ) ) (FunctionDef search_reflog_merges [] (Com {[LIT_CHARS git]} {[LIT_CHARS rev-parse]} {[ComSub (Com redirects=[(FilenameRedirectNode filename={[DQ [VarSub GIT_DIR]] [LIT_CHARS /logs/HEAD]} 0)]{[LIT_CHARS sed]} {[LIT_CHARS -ne]} {[SQ ] [DQ [VarSub 1]] [SQ ]})]} ) ) (= scope= flags=0 words=[] bindings=[('_x40', {[DQ [LIT_CHARS "[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]"]]})]) (= scope= flags=0 words=[] bindings=[('_x40', {[DQ [VarSub _x40][VarSub _x40][VarSub _x40][VarSub _x40][VarSub _x40][VarSub _x40][VarSub _x40][VarSub _x40]]})]) (FunctionDef search_merges [] (Pipeline (Com {[LIT_CHARS git]} {[LIT_CHARS rev-list]} {[LIT_CHARS --all]} {[LIT_CHARS --grep] [LIT_DBRACKET_LIKE "="] [DQ [LIT_CHARS "Merge branch '"][VarSub 1][LIT_CHARS "'"]]} {[LIT_CHARS --pretty] [LIT_DBRACKET_LIKE "="] [LIT_CHARS tformat] [LIT_OTHER ":"] [DQ [LIT_CHARS "%P %s"]]} ) (Com {[LIT_CHARS sed]} {[LIT_CHARS -ne]} {[DQ [LIT_CHARS "/^"][VarSub _x40][LIT_CHARS " "][\ LIT_ESCAPED_CHAR "\\("][VarSub _x40][\ LIT_ESCAPED_CHAR "\\)"][LIT_CHARS " Merge .*/ {s//"][\ LIT_ESCAPED_CHAR "\\1"][LIT_CHARS "/p;"][VarSub early_exit][LIT_CHARS "}"]]} ) ) ) (FunctionDef search_merge_targets [] (Pipeline (Com {[LIT_CHARS git]} {[LIT_CHARS rev-list]} {[LIT_CHARS --all]} {[LIT_CHARS --grep] [LIT_DBRACKET_LIKE "="] [DQ [LIT_CHARS "Merge branch '[^']*' into "][VarSub branch][\ LIT_ESCAPED_CHAR "\\$"]]} {[LIT_CHARS --pretty] [LIT_DBRACKET_LIKE "="] [LIT_CHARS tformat] [LIT_OTHER ":"] [DQ [LIT_CHARS "%H %s"]]} {[LIT_CHARS --all]} ) (Com {[LIT_CHARS sed]} {[LIT_CHARS -ne]} {[DQ [LIT_CHARS "/^"][\ LIT_ESCAPED_CHAR "\\("][VarSub _x40][\ LIT_ESCAPED_CHAR "\\)"][LIT_CHARS " Merge .*/ {s//"][\ LIT_ESCAPED_CHAR "\\1"][LIT_CHARS "/p;"][VarSub early_exit][LIT_CHARS "} "]]} ) ) ) (= scope= flags=0 words=[] bindings=[('dry_run', {[SQ ]})]) (= scope= flags=0 words=[] bindings=[('early_exit', {[LIT_CHARS q]})]) (= scope= flags=0 words=[] bindings=[('scan_reflog', {[LIT_CHARS t]})]) (= scope= flags=0 words=[] bindings=[('scan_reflog_merges', {[SQ ]})]) (= scope= flags=0 words=[] bindings=[('scan_merges', {[SQ ]})]) (= scope= flags=0 words=[] bindings=[('scan_merge_targets', {[SQ ]})]) (= scope= flags=0 words=[] bindings=[('new_name', {[SQ ]})]) (While (Com {[LIT_CHARS test]} {[DQ [VarSub #]]} {[LIT_NEQUAL "!="]} {[LIT_CHARS 0]} ) (List (Case to_match={[DQ [VarSub 1]]}, pat_word_list=[[{[LIT_CHARS -b]}, {[LIT_CHARS --branch]}], [{[LIT_CHARS -n]}, {[LIT_CHARS --dry-run]}], [{[LIT_CHARS --no-dry-run]}], [{[LIT_CHARS -k]}, {[LIT_CHARS --keep-going]}], [{[LIT_CHARS --no-keep-going]}], [{[LIT_CHARS -m]}, {[LIT_CHARS --merges]}], [{[LIT_CHARS --no-merges]}], [{[LIT_CHARS -l]}, {[LIT_CHARS --reflog]}], [{[LIT_CHARS --no-reflog]}], [{[LIT_CHARS -r]}, {[LIT_CHARS --reflog_merges]}], [{[LIT_CHARS --no-reflog_merges]}], [{[LIT_CHARS -t]}, {[LIT_CHARS --merge-targets]}], [{[LIT_CHARS --no-merge-targets]}], [{[LIT_CHARS -a]}, {[LIT_CHARS --all]}], [{[LIT_CHARS --]}], [{[LIT_OTHER "*"]}]] (List (Com {[LIT_CHARS shift]} ) (= scope= flags=0 words=[] bindings=[('new_name', {[DQ [VarSub 1]]})]) ) (= scope= flags=0 words=[] bindings=[('dry_run', {[LIT_CHARS t]})]) (= scope= flags=0 words=[] bindings=[('dry_run', {[SQ ]})]) (= scope= flags=0 words=[] bindings=[('early_exit', {[SQ ]})]) (= scope= flags=0 words=[] bindings=[('early_exit', {[LIT_CHARS q]})]) (= scope= flags=0 words=[] bindings=[('scan_merges', {[LIT_CHARS t]})]) (= scope= flags=0 words=[] bindings=[('scan_merges', {[SQ ]})]) (= scope= flags=0 words=[] bindings=[('scan_reflog', {[LIT_CHARS t]})]) (= scope= flags=0 words=[] bindings=[('scan_reflog', {[SQ ]})]) (= scope= flags=0 words=[] bindings=[('scan_reflog_merges', {[LIT_CHARS t]})]) (= scope= flags=0 words=[] bindings=[('scan_reflog_merges', {[SQ ]})]) (= scope= flags=0 words=[] bindings=[('scan_merge_targets', {[LIT_CHARS t]})]) (= scope= flags=0 words=[] bindings=[('scan_merge_targets', {[SQ ]})]) (List (= scope= flags=0 words=[] bindings=[('scan_reflog', {[LIT_CHARS t]})]) (= scope= flags=0 words=[] bindings=[('scan_reflog_merges', {[LIT_CHARS t]})]) (= scope= flags=0 words=[] bindings=[('scan_merges', {[LIT_CHARS t]})]) (= scope= flags=0 words=[] bindings=[('scan_merge_targets', {[LIT_CHARS t]})]) ) (List (Com {[LIT_CHARS shift]} ) (Com {[LIT_CHARS break]} ) ) (Com {[LIT_CHARS usage]} ) ) (Com {[LIT_CHARS shift]} ) ) ) (AndOr OP_OR_IF (Com {[LIT_CHARS test]} {[DQ [VarSub #]]} {[LIT_DBRACKET_LIKE "="]} {[LIT_CHARS 1]} ) (Com {[LIT_CHARS usage]} ) ) (= scope= flags=0 words=[] bindings=[('all_strategies', {[DQ [VarSub scan_reflog][VarSub scan_reflog_merges][VarSub scan_merges][VarSub scan_merge_targets]]})]) (If (Com {[LIT_CHARS test]} {[LIT_CHARS -z]} {[DQ [VarSub all_strategies]]} ) (Com {[LIT_CHARS die]} {[DQ [LIT_CHARS "must enable at least one of -lrmt"]]} ) ) (= scope= flags=0 words=[] bindings=[('branch', {[DQ [VarSub 1]]})]) (AndOr OP_AND_IF (Com {[LIT_CHARS test]} {[LIT_CHARS -z]} {[DQ [VarSub new_name]]} ) (= scope= flags=0 words=[] bindings=[('new_name', {[DQ [VarSub branch]]})]) ) (If (Com {[LIT_CHARS test]} {[LIT_OTHER "!"]} {[LIT_CHARS -z]} {[DQ [VarSub scan_reflog]]} ) (If (Com {[LIT_CHARS test]} {[LIT_CHARS -r]} {[DQ [VarSub GIT_DIR]] [LIT_CHARS /logs/HEAD]} ) (= scope= flags=0 words=[] bindings=[('candidates', {[DQ [ComSub (Com {[LIT_CHARS search_reflog]} {[VarSub branch]})]]})]) (ElseTrue) (Com {[LIT_CHARS die]} {[SQ ]} {[SQ ]} ) ) ) (If (Com {[LIT_CHARS test]} {[LIT_OTHER "!"]} {[LIT_CHARS -z]} {[DQ [VarSub scan_reflog_merges]]} ) (If (Com {[LIT_CHARS test]} {[LIT_CHARS -r]} {[DQ [VarSub GIT_DIR]] [LIT_CHARS /logs/HEAD]} ) (= scope= flags=0 words=[] bindings=[('candidates', {[DQ [VarSub candidates][LIT_CHARS " "][ComSub (Com {[LIT_CHARS search_reflog_merges]} {[VarSub branch]})]]})]) (ElseTrue) (Com {[LIT_CHARS die]} {[SQ ]} {[SQ ]} ) ) ) (If (Com {[LIT_CHARS test]} {[LIT_OTHER "!"]} {[LIT_CHARS -z]} {[DQ [VarSub scan_merges]]} ) (= scope= flags=0 words=[] bindings=[('candidates', {[DQ [VarSub candidates][LIT_CHARS " "][ComSub (Com {[LIT_CHARS search_merges]} {[VarSub branch]})]]})]) ) (If (Com {[LIT_CHARS test]} {[LIT_OTHER "!"]} {[LIT_CHARS -z]} {[DQ [VarSub scan_merge_targets]]} ) (= scope= flags=0 words=[] bindings=[('candidates', {[DQ [VarSub candidates][LIT_CHARS " "][ComSub (Com {[LIT_CHARS search_merge_targets]} {[VarSub branch]})]]})]) ) (= scope= flags=0 words=[] bindings=[('candidates', {[DQ [ComSub (Pipeline (Com {[LIT_CHARS git]} {[LIT_CHARS rev-parse]} {[VarSub candidates]}) (Com {[LIT_CHARS sort]} {[LIT_CHARS -u]}) )]]})]) (If (Com {[LIT_CHARS test]} {[LIT_CHARS -z]} {[DQ [VarSub candidates]]} ) (List (= scope= flags=0 words=[] bindings=[('hint', {[SQ ]})]) (AndOr OP_AND_IF (Com {[LIT_CHARS test]} {[DQ [LIT_CHARS z][VarSub all_strategies]]} {[LIT_NEQUAL "!="]} {[DQ [LIT_CHARS ztttt]]} ) (= scope= flags=0 words=[] bindings=[('hint', {[DQ [LIT_CHARS " (maybe try again with -a)"]]})]) ) (Com {[LIT_CHARS die]} {[DQ [LIT_CHARS "no candidates for "][VarSub branch][LIT_CHARS " found"][VarSub hint]]} ) ) ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "** Candidates for "][VarSub branch][LIT_CHARS " **"]]} ) (Pipeline (For cmt [{[VarSub candidates]}]) (Com {[LIT_CHARS git]} {[LIT_CHARS --no-pager]} {[LIT_CHARS log]} {[LIT_CHARS --pretty] [LIT_DBRACKET_LIKE "="] [LIT_CHARS tformat] [LIT_OTHER ":"] [DQ [LIT_CHARS "%ct:%h [%cr] %s"]]} {[LIT_CHARS --abbrev-commit]} {[LIT_CHARS -1]} {[VarSub cmt]} ) ) (Com {[LIT_CHARS sort]} {[LIT_CHARS -n]} ) (Com {[LIT_CHARS cut]} {[LIT_CHARS -d] [LIT_OTHER ":"]} {[LIT_CHARS -f2-]} ) ) (= scope= flags=0 words=[] bindings=[('newest', {[DQ [ComSub (Com {[LIT_CHARS git]} {[LIT_CHARS rev-list]} {[LIT_CHARS -1]} {[VarSub candidates]})]]})]) (If (Com {[LIT_CHARS test]} {[LIT_OTHER "!"]} {[LIT_CHARS -z]} {[DQ [VarSub dry_run]]} ) (List (Com {[LIT_CHARS printf]} {[DQ [LIT_CHARS "** Most recent: "]]} ) (Com {[LIT_CHARS git]} {[LIT_CHARS --no-pager]} {[LIT_CHARS log]} {[LIT_CHARS -1]} {[LIT_CHARS --pretty] [LIT_DBRACKET_LIKE "="] [LIT_CHARS tformat] [LIT_OTHER ":"] [DQ [LIT_CHARS "%h %s"]]} {[VarSub newest]} ) ) (Pipeline! (Com {[LIT_CHARS git]} {[LIT_CHARS rev-parse]} {[LIT_CHARS --verify]} {[LIT_CHARS --quiet]} {[VarSub new_name]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), > ) ) (List (Com {[LIT_CHARS printf]} {[DQ [LIT_CHARS "** Restoring "][VarSub new_name][LIT_CHARS " to "]]} ) (Com {[LIT_CHARS git]} {[LIT_CHARS --no-pager]} {[LIT_CHARS log]} {[LIT_CHARS -1]} {[LIT_CHARS --pretty] [LIT_DBRACKET_LIKE "="] [LIT_CHARS tformat] [LIT_OTHER ":"] [DQ [LIT_CHARS "%h %s"]]} {[VarSub newest]} ) (Com {[LIT_CHARS git]} {[LIT_CHARS branch]} {[VarSub new_name]} {[VarSub newest]} ) ) (ElseTrue) (List (Com {[LIT_CHARS printf]} {[DQ [LIT_CHARS "Most recent: "]]} ) (Com {[LIT_CHARS git]} {[LIT_CHARS --no-pager]} {[LIT_CHARS log]} {[LIT_CHARS -1]} {[LIT_CHARS --pretty] [LIT_DBRACKET_LIKE "="] [LIT_CHARS tformat] [LIT_OTHER ":"] [DQ [LIT_CHARS "%h %s"]]} {[VarSub newest]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "** "][VarSub new_name][LIT_CHARS " already exists, doing nothing"]]} ) ) ) )