(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:functions) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:33) command_list: (command.CommandList children: [ (command.Simple words: [{(cat)}] redirects: [ (redir.HereDoc op: (Token id:Id.Redir_DLess val:'<<' span_id:36) fd: -1 here_begin: { (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\E' span_id:38) ) (OF) } here_end_span_id: 89 stdin_parts: [ ('warn () {\n') ('\techo "$*" >&2\n') ('}\n') ('\n') ('map()\n') ('{\n') ('\t# if it was not rewritten, take the original\n') ('\tif test -r "$workdir/../map/$1"\n') ('\tthen\n') ('\t\tcat "$workdir/../map/$1"\n') ('\telse\n') ('\t\techo "$1"\n') ('\tfi\n') ('}\n') ('\n') ( '# if you run \'skip_commit "$@"\' in a commit filter, it will print\n' ) ('# the (mapped) parents, effectively skipping the commit.\n') ('\n') ('skip_commit()\n') ('{\n') ('\tshift;\n') ('\twhile [ -n "$1" ];\n') ('\tdo\n') ('\t\tshift;\n') ('\t\tmap "$1";\n') ('\t\tshift;\n') ('\tdone;\n') ('}\n') ('\n') ( '# if you run \'git_commit_non_empty_tree "$@"\' in a commit filter,\n' ) ( '# it will skip commits that leave the tree untouched, commit the other.\n' ) ('git_commit_non_empty_tree()\n') ('{\n') ( '\tif test $# = 3 && test "$1" = $(git rev-parse "$3^{tree}"); then\n' ) ('\t\tmap "$3"\n') ('\telse\n') ('\t\tgit commit-tree "$@"\n') ('\tfi\n') ('}\n') ( '# override die(): this version puts in an extra line break, so that\n' ) ('# the progress is still visible\n') ('\n') ('die()\n') ('{\n') ('\techo >&2\n') ('\techo "$*" >&2\n') ('\texit 1\n') ('}\n') ] ) ] ) ] ) ) } spids: [32] ) ] ) (C {(eval)} {(DQ ($ Id.VSub_DollarName '$functions'))}) (command.ShFunction name: finish_ident body: (command.BraceGroup children: [ (C {(echo)} { (DQ ('case ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:115) ) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\$' span_id:116)) (GIT_) ($ Id.VSub_Number '$1') (_NAME) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:120)) (' in ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:122) ) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:123)) (') GIT_') ($ Id.VSub_Number '$1') ('_NAME=') (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:127)) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:128) ) ('{GIT_') ($ Id.VSub_Number '$1') ('_EMAIL%%@*}') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:132) ) (' && export GIT_') ($ Id.VSub_Number '$1') ('_NAME;; esac') ) } ) (C {(echo)} {(DQ ('export GIT_') ($ Id.VSub_Number '$1') (_NAME))}) (C {(echo)} {(DQ ('export GIT_') ($ Id.VSub_Number '$1') (_EMAIL))}) (C {(echo)} {(DQ ('export GIT_') ($ Id.VSub_Number '$1') (_DATE))}) ] ) ) (command.ShFunction name: set_ident body: (command.BraceGroup children: [ (C {(parse_ident_from_commit)} {(author)} {(AUTHOR)} {(committer)} {(COMMITTER)}) (C {(finish_ident)} {(AUTHOR)}) (C {(finish_ident)} {(COMMITTER)}) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:USAGE) op: assign_op.Equal rhs: { (DQ ('[--env-filter <command>] [--tree-filter <command>]\n') ('\t[--index-filter <command>] [--parent-filter <command>]\n') ('\t[--msg-filter <command>] [--commit-filter <command>]\n') ('\t[--tag-name-filter <command>] [--subdirectory-filter <directory>]\n') ('\t[--original <namespace>] [-d <directory>] [-f | --force]\n') ('\t[<rev-list options>...]') ) } spids: [203] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:OPTIONS_SPEC) op: assign_op.Equal rhs: (word.Empty) spids: [214] ) ] ) (C {(.)} {(git-sh-setup)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:226) command_list: (command.CommandList children:[(C {(is_bare_repository)})]) ) ) } {(Id.Lit_Equals '=')} {(false)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:236) ) ] action: [ (C {(require_clean_work_tree)} {(SQ (Token id:Id.Lit_Chars val:'rewrite branches' span_id:244))} ) ] spids: [221 238] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tempdir) op: assign_op.Equal rhs: {(.git-rewrite)} spids: [250] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_env) op: assign_op.Equal rhs: (word.Empty) spids: [253] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_tree) op: assign_op.Equal rhs: (word.Empty) spids: [255] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_index) op: assign_op.Equal rhs: (word.Empty) spids: [257] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_parent) op: assign_op.Equal rhs: (word.Empty) spids: [259] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_msg) op: assign_op.Equal rhs: {(cat)} spids: [261] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_commit) op: assign_op.Equal rhs: (word.Empty) spids: [264] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_tag_name) op: assign_op.Equal rhs: (word.Empty) spids: [266] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_subdir) op: assign_op.Equal rhs: (word.Empty) spids: [268] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:orig_namespace) op: assign_op.Equal rhs: {(refs/original/)} spids: [270] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:force) op: assign_op.Equal rhs: (word.Empty) spids: [273] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:prune_empty) op: assign_op.Equal rhs: (word.Empty) spids: [275] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:remap_to_ancestor) op: assign_op.Equal rhs: (word.Empty) spids: [277] ) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:279) cond: [(C {(Id.Lit_Other ':')})] body: (command.DoGroup children: [ (command.Case to_match: {(DQ ($ Id.VSub_Number '$1'))} arms: [ (case_arm pat_list: [{(--)}] action: [ (C {(shift)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Break val:break span_id:302) ) ] spids: [295 296 305 -1] ) (case_arm pat_list: [{(--force)} {(-f)}] action: [ (C {(shift)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:force) op: assign_op.Equal rhs: {(t)} spids: [317] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Continue val:continue span_id:321) ) ] spids: [308 311 324 -1] ) (case_arm pat_list: [{(--remap-to-ancestor)}] action: [ (C {(shift)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:remap_to_ancestor) op: assign_op.Equal rhs: {(t)} spids: [338] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Continue val:continue span_id:342) ) ] spids: [327 328 345 -1] ) (case_arm pat_list: [{(--prune-empty)}] action: [ (C {(shift)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:prune_empty) op: assign_op.Equal rhs: {(t)} spids: [355] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Continue val:continue span_id:359) ) ] spids: [348 349 362 -1] ) (case_arm pat_list:[{(-) (Id.Lit_Star '*')}] spids:[365 367 370 -1]) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (command.Sentence child: (command.ControlFlow token: (Token id:Id.ControlFlow_Break val:break span_id:377) ) terminator: (Token id:Id.Op_Semi val:';' span_id:378) ) ] spids: [373 374 -1 381] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ARG) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [389] ) ] ) (command.Case to_match: {(DQ ($ Id.VSub_Pound '$#'))} arms: [(case_arm pat_list:[{(1)}] action:[(C {(usage)})] spids:[403 404 408 -1])] ) (C {(shift)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:OPTARG) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [416] ) ] ) (C {(shift)}) (command.Case to_match: {(DQ ($ Id.VSub_DollarName '$ARG'))} arms: [ (case_arm pat_list: [{(-d)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tempdir) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$OPTARG'))} spids: [439] ) ] ) ] spids: [435 436 445 -1] ) (case_arm pat_list: [{(--env-filter)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_env) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$OPTARG'))} spids: [452] ) ] ) ] spids: [448 449 458 -1] ) (case_arm pat_list: [{(--tree-filter)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_tree) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$OPTARG'))} spids: [465] ) ] ) ] spids: [461 462 471 -1] ) (case_arm pat_list: [{(--index-filter)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_index) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$OPTARG'))} spids: [478] ) ] ) ] spids: [474 475 484 -1] ) (case_arm pat_list: [{(--parent-filter)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_parent) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$OPTARG'))} spids: [491] ) ] ) ] spids: [487 488 497 -1] ) (case_arm pat_list: [{(--msg-filter)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_msg) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$OPTARG'))} spids: [504] ) ] ) ] spids: [500 501 510 -1] ) (case_arm pat_list: [{(--commit-filter)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_commit) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName '$functions') ('; ') ($ Id.VSub_DollarName '$OPTARG') ) } spids: [517] ) ] ) ] spids: [513 514 525 -1] ) (case_arm pat_list: [{(--tag-name-filter)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_tag_name) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$OPTARG'))} spids: [532] ) ] ) ] spids: [528 529 538 -1] ) (case_arm pat_list: [{(--subdirectory-filter)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_subdir) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$OPTARG'))} spids: [545] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:remap_to_ancestor) op: assign_op.Equal rhs: {(t)} spids: [551] ) ] ) ] spids: [541 542 555 -1] ) (case_arm pat_list: [{(--original)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:orig_namespace) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:563) command_list: (command.CommandList children: [ (C {(expr)} {(DQ ($ Id.VSub_DollarName '$OPTARG') (/))} {(Id.Lit_Other ':')} {(SQ (Token id:Id.Lit_Chars val:'\\(.*[^/]\\)/*$' span_id:574))} ) ] ) ) (/) } spids: [562] ) ] ) ] spids: [558 559 580 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [(C {(usage)})] spids: [583 584 590 -1] ) ] ) ] ) ) (command.Case to_match: {(DQ ($ Id.VSub_DollarName '$prune_empty') (',') ($ Id.VSub_DollarName '$filter_commit'))} arms: [ (case_arm pat_list: [{(Id.Lit_Comma ',')}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_commit) op: assign_op.Equal rhs: {(SQ (Token id:Id.Lit_Chars val:'git commit-tree "$@"' span_id:614))} spids: [612] ) ] ) ] spids: [608 609 616 -1] ) (case_arm pat_list: [{(t) (Id.Lit_Comma ',')}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter_commit) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$functions') (';')) (SQ (Token id:Id.Lit_Chars val:' git_commit_non_empty_tree "$@"' span_id:629)) } spids: [623] ) ] ) ] spids: [618 620 631 -1] ) (case_arm pat_list:[{(Id.Lit_Comma ',') (Id.Lit_Star '*')}] spids:[633 635 638 -1]) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [(C {(die)} {(DQ ('Cannot set --prune-empty and --commit-filter at the same time'))})] spids: [640 641 -1 650] ) ] ) (command.Case to_match: {(DQ ($ Id.VSub_DollarName '$force'))} arms: [ (case_arm pat_list: [{(t)}] action: [(C {(rm)} {(-rf)} {(DQ ($ Id.VSub_DollarName '$tempdir'))})] spids: [661 662 673 -1] ) (case_arm pat_list: [{(SQ )}] action: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(test)} {(-d)} {(DQ ($ Id.VSub_DollarName '$tempdir'))}) (C {(die)} {(DQ ($ Id.VSub_DollarName '$tempdir') (' already exists, please remove it'))} ) ] ) ] spids: [675 677 -1 698] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:orig_dir) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:701) command_list: (command.CommandList children:[(C {(pwd)})]) ) } spids: [700] ) ] ) (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DPipe] children: [ (C {(mkdir)} {(-p)} {(DQ ($ Id.VSub_DollarName '$tempdir') (/t))}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tempdir) op: assign_op.Equal rhs: { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:718) command_list: (command.CommandList children: [ (command.Sentence child: (C {(cd)} {(DQ ($ Id.VSub_DollarName '$tempdir'))}) terminator: (Token id:Id.Op_Semi val:';' span_id:724) ) (C {(pwd)}) ] ) ) ) } spids: [716] ) ] ) (C {(cd)} {(DQ ($ Id.VSub_DollarName '$tempdir') (/t))}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:workdir) op: assign_op.Equal rhs: { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:743) command_list: (command.CommandList children:[(C {(pwd)})]) ) ) } spids: [741] ) ] ) (C {(die)} {(DQ )}) ] ) (C {(trap)} {(SQ (Token id:Id.Lit_Chars val:'cd "$orig_dir"; rm -rf "$tempdir"' span_id:762))} {(0)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ORIG_GIT_DIR) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$GIT_DIR'))} spids: [768] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ORIG_GIT_WORK_TREE) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$GIT_WORK_TREE'))} spids: [773] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ORIG_GIT_INDEX_FILE) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$GIT_INDEX_FILE'))} spids: [778] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:GIT_WORK_TREE) op: assign_op.Equal rhs: {(.)} spids: [783] ) ] ) (C {(export)} {(GIT_DIR)} {(GIT_WORK_TREE)}) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{(git)} {(for-each-ref)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:800) fd: -1 arg_word: {(DQ ($ Id.VSub_DollarName '$tempdir')) (/backup-refs)} ) ] ) (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:809)) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:811) cond: [(C {(read)} {(sha1)} {(type)} {(name)})] body: (command.DoGroup children: [ (command.Case to_match: {(DQ ($ Id.VSub_DollarName '$force') (',') ($ Id.VSub_DollarName '$name'))} arms: [ (case_arm pat_list: [ {(Id.Lit_Comma ',') ($ Id.VSub_DollarName '$orig_namespace') (Id.Lit_Star '*')} ] action: [ (C {(die)} { (DQ ('Cannot create a new backup.\n') ('A previous backup already exists in ') ($ Id.VSub_DollarName '$orig_namespace') ('\n') ('Force overwriting the backup with -f') ) } ) ] spids: [835 838 852 -1] ) (case_arm pat_list: [ {(t) (Id.Lit_Comma ',') ($ Id.VSub_DollarName '$orig_namespace') (Id.Lit_Star '*')} ] action: [ (C {(git)} {(update-ref)} {(-d)} {(DQ ($ Id.VSub_DollarName '$name'))} {($ Id.VSub_DollarName '$sha1')} ) ] spids: [855 859 875 -1] ) ] ) ] ) redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:882) fd: -1 arg_word: {(DQ ($ Id.VSub_DollarName '$tempdir')) (/backup-refs)} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [ {(git)} {(rev-parse)} {(--no-flags)} {(--revs-only)} {(--symbolic-full-name)} {(--default)} {(HEAD)} {(DQ ($ Id.VSub_At '$@'))} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:913) fd: -1 arg_word: {(DQ ($ Id.VSub_DollarName '$tempdir')) (/raw-heads)} ) ] ) (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:922)) ] ) (command.Simple words: [ {(sed)} {(-e)} {(SQ (Token id:Id.Lit_Chars val:'/^^/d' span_id:929))} {(DQ ($ Id.VSub_DollarName '$tempdir')) (/raw-heads)} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:937) fd: -1 arg_word: {(DQ ($ Id.VSub_DollarName '$tempdir')) (/heads)} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(test)} {(-s)} {(DQ ($ Id.VSub_DollarName '$tempdir')) (/heads)}) (C {(die)} {(DQ ('Which ref do you want to rewrite?'))}) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:GIT_INDEX_FILE) op: assign_op.Equal rhs: { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:965) command_list: (command.CommandList children:[(C {(pwd)})]) ) (/../index) ) } spids: [963] ) ] ) (C {(export)} {(GIT_INDEX_FILE)}) (command.AndOr ops: [Id.Op_DPipe] children: [(C {(mkdir)} {(../map)}) (C {(die)} {(DQ ('Could not create map/ directory'))})] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:nonrevs) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:996) command_list: (command.CommandList children: [(C {(git)} {(rev-parse)} {(--no-revs)} {(DQ ($ Id.VSub_At '$@'))})] ) ) } spids: [995] ) ] ) (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:1010)) ] ) (command.If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ Id.VSub_DollarName '$nonrevs'))})] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:dashdash) op: assign_op.Equal rhs: {(--)} spids: [1025] ) ] ) ] spids: [1012 1022] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:dashdash) op: assign_op.Equal rhs: (word.Empty) spids: [1031] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:remap_to_ancestor) op: assign_op.Equal rhs: {(t)} spids: [1034] ) ] ) ] ) (command.Simple words: [{(git)} {(rev-parse)} {(--revs-only)} {(DQ ($ Id.VSub_At '$@'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:1050) fd: -1 arg_word: {(../parse)} ) ] ) (command.Case to_match: {(DQ ($ Id.VSub_DollarName '$filter_subdir'))} arms: [ (case_arm pat_list: [{(DQ )}] action: [ (C {(eval)} {(Id.KW_Set set)} {(--)} { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1074) command_list: (command.CommandList children: [ (C {(git)} {(rev-parse)} {(--sq)} {(--no-revs)} {(DQ ($ Id.VSub_At '$@'))}) ] ) ) ) } ) ] spids: [1062 1064 1090 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (C {(eval)} {(Id.KW_Set set)} {(--)} { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1103) command_list: (command.CommandList children: [ (C {(git)} {(rev-parse)} {(--sq)} {(--no-revs)} {(DQ ($ Id.VSub_At '$@'))} {($ Id.VSub_DollarName '$dashdash')} {(DQ ($ Id.VSub_DollarName '$filter_subdir'))} ) ] ) ) ) } ) ] spids: [1092 1093 1127 -1] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [ {(git)} {(rev-list)} {(--reverse)} {(--topo-order)} {(--default)} {(HEAD)} {(--parents)} {(--simplify-merges)} {(--stdin)} {(DQ ($ Id.VSub_At '$@'))} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:1156) fd: -1 arg_word: {(../parse)} ) (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:1159) fd: -1 arg_word: {(../revs)} ) ] ) (C {(die)} {(DQ ('Could not get the commits'))}) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:commits) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1172) command_list: (command.CommandList children: [ (command.Pipeline children: [ (command.Simple words: [{(wc)} {(-l)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:1177) fd: -1 arg_word: {(../revs)} ) ] ) (C {(tr)} {(-d)} {(DQ (' '))}) ] negated: F ) ] ) ) } spids: [1171] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(test)} {($ Id.VSub_DollarName '$commits')} {(-eq)} {(0)}) (C {(die)} {(DQ ('Found nothing to rewrite'))}) ] ) (command.ShFunction name: report_progress body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$progress'))}) (C {(test)} {($ Id.VSub_DollarName '$git_filter_branch__commit_count')} {(-gt)} {($ Id.VSub_DollarName '$next_sample_at')} ) ] ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:count) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$git_filter_branch__commit_count')} spids: [1245] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:now) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1251) command_list: (command.CommandList children: [(C {(date)} {(Id.Lit_Other '+') (Id.Lit_Other '%') (s)})] ) ) } spids: [1250] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:elapsed) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Minus left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$now')}) right: (arith_expr.ArithWord w: {($ Id.VSub_DollarName '$start_timestamp')} ) ) ) } spids: [1260] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:remaining) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Slash left: (arith_expr.Binary op_id: Id.Arith_Star left: (arith_expr.Binary op_id: Id.Arith_Minus left: (arith_expr.ArithWord w: {($ Id.VSub_DollarName '$commits')} ) right: (arith_expr.ArithWord w: {($ Id.VSub_DollarName '$count')} ) ) right: (arith_expr.ArithWord w: {($ Id.VSub_DollarName '$elapsed')} ) ) right: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$count')}) ) ) } spids: [1271] ) ] ) (command.If arms: [ (if_arm cond: [(C {(test)} {($ Id.VSub_DollarName '$elapsed')} {(-gt)} {(0)})] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:next_sample_at) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Slash left: (arith_expr.Binary op_id: Id.Arith_Star left: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.ArithWord w: {($ Id.VSub_DollarName '$elapsed')} ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) right: (arith_expr.ArithWord w: {($ Id.VSub_DollarName '$count')} ) ) right: (arith_expr.ArithWord w: {($ Id.VSub_DollarName '$elapsed')} ) ) ) } spids: [1308] ) ] ) ] spids: [1294 1305] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:next_sample_at) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.ArithWord w: {($ Id.VSub_DollarName '$next_sample_at')} ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) } spids: [1334] ) ] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:progress) op: assign_op.Equal rhs: { (DQ (' (') ($ Id.VSub_DollarName '$elapsed') (' seconds passed, remaining ') ($ Id.VSub_DollarName '$remaining') (' predicted)') ) } spids: [1348] ) ] ) ] spids: [1220 1242] ) ] ) (C {(printf)} { (DQ (Id.Lit_Other '\\') ('rRewrite ') ($ Id.VSub_DollarName '$commit') (' (') ($ Id.VSub_DollarName '$count') (/) ($ Id.VSub_DollarName '$commits') (')') ($ Id.VSub_DollarName '$progress') (' ') ) } ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:git_filter_branch__commit_count) op: assign_op.Equal rhs: {(0)} spids: [1379] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:progress) op: assign_op.Equal rhs: (word.Empty) spids: [1383] ) (assign_pair lhs: (sh_lhs_expr.Name name:start_timestamp) op: assign_op.Equal rhs: (word.Empty) spids: [1385] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Pipeline children: [ (command.Simple words: [{(date)} {(SQ (Token id:Id.Lit_Chars val:'+%s' span_id:1392))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:1395) fd: 2 arg_word: {(/dev/null)} ) ] ) (C {(grep)} {(-q)} {(SQ (Token id:Id.Lit_Chars val:'^[0-9][0-9]*$' span_id:1405))}) ] negated: F ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:next_sample_at) op: assign_op.Equal rhs: {(0)} spids: [1411] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:progress) op: assign_op.Equal rhs: {(DQ ('dummy to ensure this is not empty'))} spids: [1415] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:start_timestamp) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1422) command_list: (command.CommandList children: [ (C {(date)} {(SQ (Token id:Id.Lit_Chars val:'+%s' span_id:1426))}) ] ) ) } spids: [1421] ) ] ) ] spids: [1387 1408] ) ] ) (command.If arms: [ (if_arm cond: [ (command.AndOr ops: [Id.Op_DPipe Id.Op_DPipe] children: [ (C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$filter_index'))}) (C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$filter_tree'))}) (C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$filter_subdir'))}) ] ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:need_index) op: assign_op.Equal rhs: {(t)} spids: [1468] ) ] ) ] spids: [1433 1465] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:need_index) op: assign_op.Equal rhs: (word.Empty) spids: [1474] ) ] ) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:1479) cond: [ (command.Sentence child: (C {(read)} {(commit)} {(parents)}) terminator: (Token id:Id.Op_Semi val:';' span_id:1486) ) ] body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:git_filter_branch__commit_count) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.ArithWord w: {($ Id.VSub_DollarName '$git_filter_branch__commit_count')} ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) } spids: [1491] ) ] ) (C {(report_progress)}) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Case to_match: {(DQ ($ Id.VSub_DollarName '$filter_subdir'))} arms: [ (case_arm pat_list: [{(DQ )}] action: [ (command.If arms: [ (if_arm cond: [(C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$need_index'))})] action: [ (command.Simple words: [ {(git)} {(read-tree)} {(-i)} {(-m)} {($ Id.VSub_DollarName '$commit')} ] more_env: [ (env_pair name: GIT_ALLOW_NULL_SHA1 val: {(1)} spids: [1533] ) ] ) ] spids: [1519 1530] ) ] ) ] spids: [1514 1516 1550 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:err) op: assign_op.Equal rhs: { (command_sub left_token: (Token id: Id.Left_DollarParen val: '$(' span_id: 1562 ) command_list: (command.CommandList children: [ (command.Simple words: [ {(git)} {(read-tree)} {(-i)} {(-m)} {($ Id.VSub_DollarName '$commit') (Id.Lit_Other ':') (DQ ($ Id.VSub_DollarName '$filter_subdir')) } ] redirects: [ (redir.Redir op: (Token id: Id.Redir_GreatAnd val: '2>&' span_id: 1582 ) fd: 2 arg_word: {(1)} ) ] more_env: [ (env_pair name: GIT_ALLOW_NULL_SHA1 val: {(1)} spids: [1563] ) ] ) ] ) ) } spids: [1561] ) ] ) (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Pipeline children: [ (C {(git)} {(rev-parse)} {(-q)} {(--verify)} {($ Id.VSub_DollarName '$commit') (Id.Lit_Other ':') (DQ ($ Id.VSub_DollarName '$filter_subdir')) } ) ] negated: T ) ] action: [ (C {(rm)} {(-f)} {(DQ ($ Id.VSub_DollarName '$GIT_INDEX_FILE'))}) ] spids: [1591 1610] ) ] else_action: [ (command.Simple words: [{(echo)} {(DQ ($ Id.VSub_DollarName '$err'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:1627) fd: -1 arg_word: {(2)} ) ] ) (C {(false)}) ] ) ] ) ] ) ] spids: [1553 1554 -1 1644] ) ] ) (C {(die)} {(DQ ('Could not initialize the index'))}) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:GIT_COMMIT) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$commit')} spids: [1656] ) ] ) (C {(export)} {(GIT_COMMIT)}) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{(git)} {(cat-file)} {(commit)} {(DQ ($ Id.VSub_DollarName '$commit'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:1675) fd: -1 arg_word: {(../commit)} ) ] ) (C {(die)} {(DQ ('Cannot read commit ') ($ Id.VSub_DollarName '$commit'))}) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(eval)} { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1693) command_list: (command.CommandList children: [ (command.Simple words: [{(set_ident)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:1696) fd: -1 arg_word: {(../commit)} ) ] ) ] ) ) ) } ) (C {(die)} { (DQ ('setting author/committer failed for commit ') ($ Id.VSub_DollarName '$commit') ) } ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{(eval)} {(DQ ($ Id.VSub_DollarName '$filter_env'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:1718) fd: -1 arg_word: {(/dev/null)} ) ] ) (C {(die)} {(DQ ('env filter failed: ') ($ Id.VSub_DollarName '$filter_env'))}) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$filter_tree'))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:1743) ) ] action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(git)} {(checkout-index)} {(-f)} {(-u)} {(-a)}) (C {(die)} {(DQ ('Could not checkout the index'))}) ] ) (C {(git)} {(clean)} {(-d)} {(-q)} {(-f)} {(-x)}) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{(eval)} {(DQ ($ Id.VSub_DollarName '$filter_tree'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:1795) fd: -1 arg_word: {(/dev/null)} ) ] ) (C {(die)} {(DQ ('tree filter failed: ') ($ Id.VSub_DollarName '$filter_tree'))}) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(git)} {(diff-index)} {(-r)} {(--name-only)} {(--ignore-submodules)} {($ Id.VSub_DollarName '$commit')} {(--)} ) (C {(git)} {(ls-files)} {(--others)}) ] ) ] ) redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:1840) fd: -1 arg_word: {(DQ ($ Id.VSub_DollarName '$tempdir')) (/tree-state)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1849) ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{(git)} {(update-index)} {(--add)} {(--replace)} {(--remove)} {(--stdin)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:1866) fd: -1 arg_word: {(DQ ($ Id.VSub_DollarName '$tempdir')) (/tree-state)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1875) ) ] ) ] spids: [1734 1745] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{(eval)} {(DQ ($ Id.VSub_DollarName '$filter_index'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:1888) fd: -1 arg_word: {(/dev/null)} ) ] ) (C {(die)} {(DQ ('index filter failed: ') ($ Id.VSub_DollarName '$filter_index'))}) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:parentstr) op: assign_op.Equal rhs: (word.Empty) spids: [1904] ) ] ) (command.ForEach iter_name: parent iter_words: [{($ Id.VSub_DollarName '$parents')}] do_arg_iter: F body: (command.DoGroup children: [ (command.ForEach iter_name: reparent iter_words: [ { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1925) command_list: (command.CommandList children: [(C {(map)} {(DQ ($ Id.VSub_DollarName '$parent'))})] ) ) } ] do_arg_iter: F body: (command.DoGroup children: [ (command.Case to_match: {(DQ ($ Id.VSub_DollarName '$parentstr') (' '))} arms: [ (case_arm pat_list: [ {(Id.Lit_Star '*') (DQ (' -p ') ($ Id.VSub_DollarName '$reparent') (' ')) (Id.Lit_Star '*') } ] spids: [1947 1954 1957 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:parentstr) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName '$parentstr') (' -p ') ($ Id.VSub_DollarName '$reparent') ) } spids: [1964] ) ] ) ] spids: [1960 1961 1972 -1] ) ] ) ] ) ) ] ) ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$filter_parent'))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:1993) ) ] action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:parentstr) op: assign_op.Equal rhs: { (DQ (command_sub left_token: (Token id: Id.Left_DollarParen val: '$(' span_id: 2000 ) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {(DQ ($ Id.VSub_DollarName '$parentstr'))}) (C {(eval)} {(DQ ($ Id.VSub_DollarName '$filter_parent'))} ) ] negated: F ) ] ) ) ) } spids: [1998] ) ] ) (C {(die)} {(DQ ('parent filter failed: ') ($ Id.VSub_DollarName '$filter_parent'))} ) ] ) ] spids: [1984 1995] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Pipeline children: [ (command.BraceGroup children: [ (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:2035) cond: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.Simple words: [{(read)} {(-r)} {(header_line)}] more_env: [(env_pair name:IFS val:{(SQ )} spids:[2037])] ) (C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$header_line'))}) ] ) ] body: (command.DoGroup children: [ (command.Sentence child: (C {(Id.Lit_Other ':')}) terminator: (Token id:Id.Op_Semi val:';' span_id:2066) ) ] ) ) (C {(cat)}) ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:2081) fd: -1 arg_word: {(../commit)} ) ] ) (command.Simple words: [{(eval)} {(DQ ($ Id.VSub_DollarName '$filter_msg'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:2093) fd: -1 arg_word: {(../message)} ) ] ) ] negated: F ) (C {(die)} {(DQ ('msg filter failed: ') ($ Id.VSub_DollarName '$filter_msg'))}) ] ) (command.If arms: [ (if_arm cond: [(C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$need_index'))})] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tree) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:2124) command_list: (command.CommandList children: [(C {(git)} {(write-tree)})] ) ) } spids: [2123] ) ] ) ] spids: [2109 2120] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tree) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:2135) command_list: (command.CommandList children: [ (C {(git)} {(rev-parse)} {(DQ ($ Id.VSub_DollarName '$commit') ('^{tree}'))} ) ] ) ) } spids: [2134] ) ] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [ {(Id.Lit_Splice '@SHELL_PATH') (Id.Lit_Other '@')} {(-c)} {(DQ ($ Id.VSub_DollarName '$filter_commit'))} {(DQ ('git commit-tree'))} {(DQ ($ Id.VSub_DollarName '$tree'))} {($ Id.VSub_DollarName '$parentstr')} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:2174) fd: -1 arg_word: {(../message)} ) (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:2178) fd: -1 arg_word: {(../map/) ($ Id.VSub_DollarName '$commit')} ) ] more_env: [ (env_pair name: workdir val: {($ Id.VSub_DollarName '$workdir')} spids: [2150] ) ] ) (C {(die)} {(DQ ('could not write rewritten commit'))}) ] ) ] ) redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:2194) fd: -1 arg_word: {(../revs)} ) ] ) (command.If arms: [ (if_arm cond: [ (C {(test)} {(DQ ($ Id.VSub_DollarName '$remap_to_ancestor'))} {(Id.Lit_Equals '=')} {(t)}) ] action: [ (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:2229) cond: [(C {(read)} {(ref)})] body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sha1) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:2240) command_list: (command.CommandList children: [ (C {(git)} {(rev-parse)} {(DQ ($ Id.VSub_DollarName '$ref')) (Id.Lit_Other '^') (0)} ) ] ) ) } spids: [2239] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(test)} {(-f)} {(DQ ($ Id.VSub_DollarName '$workdir')) (/../map/) ($ Id.VSub_DollarName '$sha1') } ) (command.ControlFlow token: (Token id:Id.ControlFlow_Continue val:continue span_id:2265) ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ancestor) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:2269) command_list: (command.CommandList children: [ (C {(git)} {(rev-list)} {(--simplify-merges)} {(-1)} {(DQ ($ Id.VSub_DollarName '$ref'))} {(DQ ($ Id.VSub_At '$@'))} ) ] ) ) } spids: [2268] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(test)} {(DQ ($ Id.VSub_DollarName '$ancestor'))}) (command.Simple words: [ {(echo)} { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:2298) command_list: (command.CommandList children: [(C {(map)} {($ Id.VSub_DollarName '$ancestor')})] ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_DGreat val:'>>' span_id:2304) fd: -1 arg_word: {(DQ ($ Id.VSub_DollarName '$workdir')) (/../map/) ($ Id.VSub_DollarName '$sha1') } ) ] ) ] ) ] ) redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:2315) fd: -1 arg_word: {(DQ ($ Id.VSub_DollarName '$tempdir')) (/heads)} ) ] ) ] spids: [2214 2226] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:_x40) op: assign_op.Equal rhs: {(SQ (Token id:Id.Lit_Chars val:'[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' span_id:2331))} spids: [2329] ) ] ) (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: [2334] ) ] ) (C {(echo)}) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:2348) cond: [(C {(read)} {(ref)})] body: (command.DoGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(test)} {(-f)} {(DQ ($ Id.VSub_DollarName '$orig_namespace') ($ Id.VSub_DollarName '$ref'))} ) (command.ControlFlow token: (Token id:Id.ControlFlow_Continue val:continue span_id:2372) ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sha1) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:2377) command_list: (command.CommandList children: [ (C {(git)} {(rev-parse)} {(DQ ($ Id.VSub_DollarName '$ref')) (Id.Lit_Other '^') (0)} ) ] ) ) } spids: [2376] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:rewritten) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:2391) command_list: (command.CommandList children: [(C {(map)} {($ Id.VSub_DollarName '$sha1')})] ) ) } spids: [2390] ) ] ) (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (C {(test)} {($ Id.VSub_DollarName '$sha1')} {(Id.Lit_Equals '=')} {(DQ ($ Id.VSub_DollarName '$rewritten'))} ) (C {(warn)} {(DQ ("WARNING: Ref '") ($ Id.VSub_DollarName '$ref') ("' is unchanged"))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Continue val:continue span_id:2423) ) ] ) (command.Case to_match: {(DQ ($ Id.VSub_DollarName '$rewritten'))} arms: [ (case_arm pat_list: [{(SQ )}] action: [ (C {(echo)} {(DQ ("Ref '") ($ Id.VSub_DollarName '$ref') ("' was deleted"))}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(git)} {(update-ref)} {(-m)} {(DQ ('filter-branch: delete'))} {(-d)} {(DQ ($ Id.VSub_DollarName '$ref'))} {($ Id.VSub_DollarName '$sha1')} ) (C {(die)} {(DQ ('Could not delete ') ($ Id.VSub_DollarName '$ref'))}) ] ) ] spids: [2436 2438 2479 -1] ) (case_arm pat_list: [{($ Id.VSub_DollarName '$_x40')}] action: [ (C {(echo)} {(DQ ("Ref '") ($ Id.VSub_DollarName '$ref') ("' was rewritten"))}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [ (command.Simple words: [ {(git)} {(update-ref)} {(-m)} {(DQ ('filter-branch: rewrite'))} {(DQ ($ Id.VSub_DollarName '$ref'))} {($ Id.VSub_DollarName '$rewritten')} {($ Id.VSub_DollarName '$sha1')} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:2519) fd: 2 arg_word: {(/dev/null)} ) ] ) ] negated: T ) terminator: (Token id:Id.Op_Semi val:';' span_id:2521) ) ] action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(test)} { (command_sub left_token: (Token id: Id.Left_DollarParen val: '$(' span_id: 2530 ) command_list: (command.CommandList children: [ (C {(git)} {(cat-file)} {(-t)} {(DQ ($ Id.VSub_DollarName '$ref'))} ) ] ) ) } {(Id.Lit_Equals '=')} {(tag)} ) terminator: (Token id:Id.Op_Semi val:';' span_id:2545) ) ] action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(test)} {(-z)} {(DQ ($ Id.VSub_DollarName '$filter_tag_name'))} ) terminator: (Token id:Id.Op_Semi val:';' span_id:2559) ) ] action: [ (C {(warn)} { (DQ ( 'WARNING: You said to rewrite tagged commits, but not the corresponding tag.' ) ) } ) (C {(warn)} { (DQ ( "WARNING: Perhaps use '--tag-name-filter cat' to rewrite the tag." ) ) } ) ] spids: [2550 2561] ) ] ) ] spids: [2526 2547] ) ] else_action: [ (C {(die)} {(DQ ('Could not rewrite ') ($ Id.VSub_DollarName '$ref'))}) ] ) ] spids: [2495 2523] ) ] ) ] spids: [2482 2483 2598 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (C {(warn)} { (DQ ("WARNING: '") ($ Id.VSub_DollarName '$ref') ("' was rewritten into multiple commits:") ) } ) (C {(warn)} {(DQ ($ Id.VSub_DollarName '$rewritten'))}) (C {(warn)} { (DQ ("WARNING: Ref '") ($ Id.VSub_DollarName '$ref') ("' points to the first one now.") ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:rewritten) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:2635) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {(DQ ($ Id.VSub_DollarName '$rewritten'))}) (C {(head)} {(-n)} {(1)}) ] negated: F ) ] ) ) } spids: [2634] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(git)} {(update-ref)} {(-m)} {(DQ ('filter-branch: rewrite to first'))} {(DQ ($ Id.VSub_DollarName '$ref'))} {($ Id.VSub_DollarName '$rewritten')} {($ Id.VSub_DollarName '$sha1')} ) (C {(die)} {(DQ ('Could not rewrite ') ($ Id.VSub_DollarName '$ref'))}) ] ) ] spids: [2601 2602 2683 -1] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(git)} {(update-ref)} {(-m)} {(DQ ('filter-branch: backup'))} {(DQ ($ Id.VSub_DollarName '$orig_namespace') ($ Id.VSub_DollarName '$ref'))} {($ Id.VSub_DollarName '$sha1')} ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:2709) ) ] ) ] ) redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:2713) fd: -1 arg_word: {(DQ ($ Id.VSub_DollarName '$tempdir')) (/heads)} ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$filter_tag_name'))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:2740) ) ] action: [ (command.Pipeline children: [ (C {(git)} {(for-each-ref)} {(--format) (Id.Lit_Equals '=') (SQ (Token id: Id.Lit_Chars val: '%(objectname) %(objecttype) %(refname)' span_id: 2752 ) ) } {(refs/tags)} ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:2760) cond: [ (command.Sentence child: (C {(read)} {(sha1)} {(type)} {(ref)}) terminator: (Token id:Id.Op_Semi val:';' span_id:2769) ) ] body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ref) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:ref span_id:2777) suffix_op: (suffix_op.Unary op_id: Id.VOp1_Pound arg_word: {(refs) (Id.Lit_Slash /) (tags) (Id.Lit_Slash /)} ) ) ) } spids: [2774] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$type'))} {(Id.KW_Bang '!') (Id.Lit_Equals '=')} {(DQ (commit))} {(-a)} {(DQ ($ Id.VSub_DollarName '$type'))} {(Id.KW_Bang '!') (Id.Lit_Equals '=')} {(DQ (tag))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:2820) ) ] action: [ (command.Sentence child: (command.ControlFlow token: (Token id: Id.ControlFlow_Continue val: continue span_id: 2825 ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:2826) ) ] spids: [2791 2822] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$type'))} {(Id.Lit_Equals '=')} {(DQ (tag))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:2848) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sha1t) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$sha1'))} spids: [2857] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sha1) op: assign_op.Equal rhs: { (DQ (command_sub left_token: (Token id: Id.Left_DollarParen val: '$(' span_id: 2865 ) command_list: (command.CommandList children: [ (C {(git)} {(rev-parse)} {(-q)} {(DQ ($ Id.VSub_DollarName '$sha1')) (Id.Lit_Other '^') (Id.Lit_LBrace '{') (commit) (Id.Lit_RBrace '}') } ) ] ) ) ) } spids: [2863] ) ] ) (command.ControlFlow token: (Token id: Id.ControlFlow_Continue val: continue span_id: 2884 ) ) ] ) ] spids: [2833 2850] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(Id.Lit_LBracket '[')} {(-f)} {(DQ (../map/) ($ Id.VSub_DollarName '$sha1'))} {(Id.Lit_RBracket ']')} ) (command.ControlFlow token: (Token id:Id.ControlFlow_Continue val:continue span_id:2904) ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:new_sha1) op: assign_op.Equal rhs: { (DQ (command_sub left_token: (Token id: Id.Left_DollarParen val: '$(' span_id: 2909 ) command_list: (command.CommandList children: [ (C {(cat)} {(DQ (../map/) ($ Id.VSub_DollarName '$sha1'))}) ] ) ) ) } spids: [2907] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:GIT_COMMIT) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$sha1'))} spids: [2920] ) ] ) (C {(export)} {(GIT_COMMIT)}) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:new_ref) op: assign_op.Equal rhs: { (DQ (command_sub left_token: (Token id: Id.Left_DollarParen val: '$(' span_id: 2933 ) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {(DQ ($ Id.VSub_DollarName '$ref'))}) (C {(eval)} {(DQ ($ Id.VSub_DollarName '$filter_tag_name'))} ) ] negated: F ) ] ) ) ) } spids: [2931] ) ] ) (C {(die)} { (DQ ('tag name filter failed: ') ($ Id.VSub_DollarName '$filter_tag_name') ) } ) ] ) (C {(echo)} { (DQ ($ Id.VSub_DollarName '$ref') (' -> ') ($ Id.VSub_DollarName '$new_ref') (' (') ($ Id.VSub_DollarName '$sha1') (' -> ') ($ Id.VSub_DollarName '$new_sha1') (')') ) } ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$type'))} {(Id.Lit_Equals '=')} {(DQ (tag))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:2992) ) ] action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:new_sha1) op: assign_op.Equal rhs: { (command_sub left_token: (Token id: Id.Left_DollarParen val: '$(' span_id: 2998 ) command_list: (command.CommandList children: [ (command.Pipeline children: [ (command.Subshell command_list: (command.CommandList children: [ (C {(printf)} { (SQ (Token id: Id.Lit_Chars val: 'object %s\\ntype commit\\ntag %s\\n' span_id: 3005 ) ) } {(DQ ($ Id.VSub_DollarName '$new_sha1'))} {(DQ ($ Id.VSub_DollarName '$new_ref'))} ) (command.Pipeline children: [ (C {(git)} {(cat-file)} {(tag)} { (DQ ($ Id.VSub_DollarName '$ref' ) ) } ) (C {(sed)} {(-n)} {(-e)} { (SQ (Token id: Id.Lit_Chars val: '1,/^$/{\n' span_id: 3041 ) (Token id:Id.Lit_Chars val:'\t\t\t\t\t /^object /d\n' span_id:3042) (Token id: Id.Lit_Chars val: '\t\t\t\t\t /^type /d\n' span_id: 3043 ) (Token id:Id.Lit_Chars val:'\t\t\t\t\t /^tag /d\n' span_id:3044) (Token id: Id.Lit_Chars val: '\t\t\t\t\t}' span_id: 3045 ) ) } {(-e)} {(SQ (Token id:Id.Lit_Chars val:'/^-----BEGIN PGP SIGNATURE-----/q' span_id:3053))} {(-e)} { (SQ (Token id: Id.Lit_Chars val: p span_id: 3061 ) ) } ) ] negated: F ) ] ) ) (C {(git)} {(mktag)}) ] negated: F ) ] ) ) } spids: [2997] ) ] ) (C {(die)} { (DQ ('Could not create new tag object for ') ($ Id.VSub_DollarName '$ref') ) } ) ] ) (command.If arms: [ (if_arm cond: [ (command.Pipeline children: [ (C {(git)} {(cat-file)} {(tag)} {(DQ ($ Id.VSub_DollarName '$ref'))} ) (command.Simple words: [ {(sane_grep)} { (SQ (Token id: Id.Lit_Chars val: '^-----BEGIN PGP SIGNATURE-----' span_id: 3104 ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:3107) fd: -1 arg_word: {(/dev/null)} ) (redir.Redir op: (Token id: Id.Redir_GreatAnd val: '2>&' span_id: 3110 ) fd: 2 arg_word: {(1)} ) ] ) ] negated: F ) ] action: [ (C {(warn)} { (DQ ('gpg signature stripped from tag object ') ($ Id.VSub_DollarName '$sha1t') ) } ) ] spids: [3085 3114] ) ] ) ] spids: [2977 2994] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(git)} {(update-ref)} {(DQ (refs/tags/) ($ Id.VSub_DollarName '$new_ref'))} {(DQ ($ Id.VSub_DollarName '$new_sha1'))} ) (C {(die)} {(DQ ('Could not write tag ') ($ Id.VSub_DollarName '$new_ref'))}) ] ) ] ) ) ] negated: F ) ] spids: [2731 2742] ) ] ) (C {(cd)} {(DQ ($ Id.VSub_DollarName '$orig_dir'))}) (C {(rm)} {(-rf)} {(DQ ($ Id.VSub_DollarName '$tempdir'))}) (C {(trap)} {(-)} {(0)}) (C {(unset)} {(GIT_DIR)} {(GIT_WORK_TREE)} {(GIT_INDEX_FILE)}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(test)} {(-z)} {(DQ ($ Id.VSub_DollarName '$ORIG_GIT_DIR'))}) (command.BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:GIT_DIR) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$ORIG_GIT_DIR'))} spids: [3204] ) ] ) (C {(export)} {(GIT_DIR)}) ] ) ] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(test)} {(-z)} {(DQ ($ Id.VSub_DollarName '$ORIG_GIT_WORK_TREE'))}) (command.BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:GIT_WORK_TREE) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$ORIG_GIT_WORK_TREE'))} spids: [3230] ) ] ) (C {(export)} {(GIT_WORK_TREE)}) ] ) ] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(test)} {(-z)} {(DQ ($ Id.VSub_DollarName '$ORIG_GIT_INDEX_FILE'))}) (command.BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:GIT_INDEX_FILE) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$ORIG_GIT_INDEX_FILE'))} spids: [3257] ) ] ) (C {(export)} {(GIT_INDEX_FILE)}) ] ) ] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:3277) command_list: (command.CommandList children:[(C {(is_bare_repository)})]) ) ) } {(Id.Lit_Equals '=')} {(false)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:3287) ) ] action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(git)} {(read-tree)} {(-u)} {(-m)} {(HEAD)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:3304) ) ] ) ] spids: [3272 3289] ) ] ) (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:3309) arg_word:{(0)}) ] )