#!/bin/sh # # This program resolves merge conflicts in git # # Copyright (c) 2006 Theodore Y. Ts'o # Copyright (c) 2009-2016 David Aguilar # # This file is licensed under the GPL v2, or a later version # at the discretion of Junio C Hamano. # global USAGE := ''[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-O] [file to merge] ...'' global SUBDIRECTORY_OK := 'Yes' global NONGIT_OK := 'Yes' global OPTIONS_SPEC := '' global TOOL_MODE := 'merge' source git-sh-setup source git-mergetool--lib # Returns true if the mode reflects a symlink proc is_symlink { test $1 = 120000 } proc is_submodule { test $1 = 160000 } proc local_present { test -n $local_mode } proc remote_present { test -n $remote_mode } proc base_present { test -n $base_mode } proc mergetool_tmpdir_init { if test $[git config --bool mergetool.writeToTemp] != true { global MERGETOOL_TMPDIR := '.' return 0 } if global MERGETOOL_TMPDIR := $[mktemp -d -t "git-mergetool-XXXXXX" !2 >/dev/null] { return 0 } die "error: mktemp is needed when 'mergetool.writeToTemp' is true" } proc cleanup_temp_files { if test $1 = --save-backup { rm -rf -- "$MERGED.orig" test -e $BACKUP && mv -- $BACKUP "$MERGED.orig" rm -f -- $LOCAL $REMOTE $BASE } else { rm -f -- $LOCAL $REMOTE $BASE $BACKUP } if test $MERGETOOL_TMPDIR != "." { rmdir $MERGETOOL_TMPDIR } } proc describe_file { global mode := $1 global branch := $2 global file := $3 printf " {%s}: " $branch if test -z $mode { echo "deleted" } elif is_symlink $mode { echo "a symbolic link -> '$[cat $file]'" } elif is_submodule $mode { echo "submodule commit $file" } elif base_present { echo "modified file" } else { echo "created file" } } proc resolve_symlink_merge { while true { printf "Use (l)ocal or (r)emote, or (a)bort? " read ans || return 1 matchstr $ans { [lL]* { git checkout-index -f --stage=2 -- $MERGED git add -- $MERGED cleanup_temp_files --save-backup return 0 } [rR]* { git checkout-index -f --stage=3 -- $MERGED git add -- $MERGED cleanup_temp_files --save-backup return 0 } [aA]* { return 1 } } } } proc resolve_deleted_merge { while true { if base_present { printf "Use (m)odified or (d)eleted file, or (a)bort? " } else { printf "Use (c)reated or (d)eleted file, or (a)bort? " } read ans || return 1 matchstr $ans { [mMcC]* { git add -- $MERGED if test $merge_keep_backup = "true" { cleanup_temp_files --save-backup } else { cleanup_temp_files } return 0 } [dD]* { git rm -- $MERGED > /dev/null cleanup_temp_files return 0 } [aA]* { if test $merge_keep_temporaries = "false" { cleanup_temp_files } return 1 } } } } proc resolve_submodule_merge { while true { printf "Use (l)ocal or (r)emote, or (a)bort? " read ans || return 1 matchstr $ans { [lL]* { if ! local_present { if test -n $[git ls-tree HEAD -- $MERGED] { # Local isn't present, but it's a subdirectory git ls-tree --full-name -r HEAD -- $MERGED | git update-index --index-info || exit $Status } else { test -e $MERGED && mv -- $MERGED $BACKUP git update-index --force-remove $MERGED cleanup_temp_files --save-backup } } elif is_submodule $local_mode { stage_submodule $MERGED $local_sha1 } else { git checkout-index -f --stage=2 -- $MERGED git add -- $MERGED } return 0 } [rR]* { if ! remote_present { if test -n $[git ls-tree MERGE_HEAD -- $MERGED] { # Remote isn't present, but it's a subdirectory git ls-tree --full-name -r MERGE_HEAD -- $MERGED | git update-index --index-info || exit $Status } else { test -e $MERGED && mv -- $MERGED $BACKUP git update-index --force-remove $MERGED } } elif is_submodule $remote_mode { ! is_submodule $local_mode && test -e $MERGED && mv -- $MERGED $BACKUP stage_submodule $MERGED $remote_sha1 } else { test -e $MERGED && mv -- $MERGED $BACKUP git checkout-index -f --stage=3 -- $MERGED git add -- $MERGED } cleanup_temp_files --save-backup return 0 } [aA]* { return 1 } } } } proc stage_submodule { global path := $1 global submodule_sha1 := $2 mkdir -p $path || die "fatal: unable to create directory for module at $path" # Find $path relative to work tree global work_tree_root := $[cd_to_toplevel && pwd] global work_rel_path := $[cd $path && env GIT_WORK_TREE=$(work_tree_root) git rev-parse --show-prefix] test -n $work_rel_path || die "fatal: unable to get path of module $path relative to work tree" git update-index --add --replace --cacheinfo 160000 $submodule_sha1 $(work_rel_path%/) || die } proc checkout_staged_file { global tmpfile := $[expr \ $[git checkout-index --temp --stage="$1" $2 !2 >/dev/null] \ : '\([^ ]*\) ] if test $Status -eq 0 && test -n $tmpfile { mv -- "$[git rev-parse --show-cdup]$tmpfile" $3 } else { >$3 } } proc merge_file { global MERGED := $1 global f := $[git ls-files -u -- $MERGED] if test -z $f { if test ! -f $MERGED { echo "$MERGED: file not found" } else { echo "$MERGED: file does not need merging" } return 1 } if global BASE := $[expr $MERGED : '\(.*\)\.[^/]*$] { global ext := $[expr $MERGED : '.*\(\.[^/]*\)$] } else { global BASE := $MERGED global ext := '' } mergetool_tmpdir_init if test $MERGETOOL_TMPDIR != "." { # If we're using a temporary directory then write to the # top-level of that directory. global BASE := $(BASE##*/) } global BACKUP := ""$MERGETOOL_TMPDIR/$(BASE)_BACKUP_$Pid$ext"" global LOCAL := ""$MERGETOOL_TMPDIR/$(BASE)_LOCAL_$Pid$ext"" global REMOTE := ""$MERGETOOL_TMPDIR/$(BASE)_REMOTE_$Pid$ext"" global BASE := ""$MERGETOOL_TMPDIR/$(BASE)_BASE_$Pid$ext"" global base_mode := $[git ls-files -u -- $MERGED | awk '{if ($3==1) print $1;}] global local_mode := $[git ls-files -u -- $MERGED | awk '{if ($3==2) print $1;}] global remote_mode := $[git ls-files -u -- $MERGED | awk '{if ($3==3) print $1;}] if is_submodule $local_mode || is_submodule $remote_mode { echo "Submodule merge conflict for '$MERGED':" global local_sha1 := $[git ls-files -u -- $MERGED | awk '{if ($3==2) print $2;}] global remote_sha1 := $[git ls-files -u -- $MERGED | awk '{if ($3==3) print $2;}] describe_file $local_mode "local" $local_sha1 describe_file $remote_mode "remote" $remote_sha1 resolve_submodule_merge return } if test -f $MERGED { mv -- $MERGED $BACKUP cp -- $BACKUP $MERGED } # Create a parent directory to handle delete/delete conflicts # where the base's directory no longer exists. mkdir -p $[dirname $MERGED] checkout_staged_file 1 $MERGED $BASE checkout_staged_file 2 $MERGED $LOCAL checkout_staged_file 3 $MERGED $REMOTE if test -z $local_mode || test -z $remote_mode { echo "Deleted merge conflict for '$MERGED':" describe_file $local_mode "local" $LOCAL describe_file $remote_mode "remote" $REMOTE resolve_deleted_merge global status := $Status rmdir -p $[dirname $MERGED] !2 >/dev/null return $status } if is_symlink $local_mode || is_symlink $remote_mode { echo "Symbolic link merge conflict for '$MERGED':" describe_file $local_mode "local" $LOCAL describe_file $remote_mode "remote" $REMOTE resolve_symlink_merge return } echo "Normal merge conflict for '$MERGED':" describe_file $local_mode "local" $LOCAL describe_file $remote_mode "remote" $REMOTE if test $guessed_merge_tool = true || test $prompt = true { printf "Hit return to start merge resolution tool (%s): " $merge_tool read ans || return 1 } if base_present { global present := 'true' } else { global present := 'false' } if ! run_merge_tool $merge_tool $present { echo "merge of $MERGED failed" !1 > !2 mv -- $BACKUP $MERGED if test $merge_keep_temporaries = "false" { cleanup_temp_files } return 1 } if test $merge_keep_backup = "true" { mv -- $BACKUP "$MERGED.orig" } else { rm -- $BACKUP } git add -- $MERGED cleanup_temp_files return 0 } proc prompt_after_failed_merge { while true { printf "Continue merging other unresolved paths [y/n]? " read ans || return 1 matchstr $ans { [yY]* { return 0 } [nN]* { return 1 } } } } proc print_noop_and_exit { echo "No files need merging" exit 0 } proc main { global prompt := $[git config --bool mergetool.prompt] global guessed_merge_tool := 'false' global orderfile := '' while test $# != 0 { matchstr $1 { --tool-help=* { global TOOL_MODE := $(1#--tool-help=) show_tool_help } --tool-help { show_tool_help } -t|--tool* { matchstr "$Argc,$1" { *,*=* { global merge_tool := $[expr "z$1" : 'z-[^=]*=\(.*\)] } 1,* { usage } * { global merge_tool := $2 shift } } } -y|--no-prompt { global prompt := 'false' } --prompt { global prompt := 'true' } -O* { global orderfile := $1 } -- { shift break } -* { usage } * { break } } shift } git_dir_init require_work_tree if test -z $merge_tool { # Check if a merge tool has been configured global merge_tool := $[get_configured_merge_tool] # Try to guess an appropriate merge tool if no tool has been set. if test -z $merge_tool { global merge_tool := $[guess_merge_tool] || exit global guessed_merge_tool := 'true' } } global merge_keep_backup := $[git config --bool mergetool.keepBackup || echo true] global merge_keep_temporaries := $[git config --bool mergetool.keepTemporaries || echo false] if test $Argc -eq 0 && test -e "$GIT_DIR/MERGE_RR" { set -- $[git rerere remaining] if test $Argc -eq 0 { print_noop_and_exit } } global files := $[git -c core.quotePath=false \ diff --name-only --diff-filter=U \ $(orderfile:+"$orderfile") -- @Argv] cd_to_toplevel if test -z $files { print_noop_and_exit } printf "Merging:\n" printf "%s\n" $files global rc := '0' for i in [$files] { printf "\n" if ! merge_file $i { global rc := '1' prompt_after_failed_merge || exit 1 } } exit $rc } main @Argv (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:USAGE) op: Equal rhs: { (SQ < "[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-O] [file to merge] ..." > ) } spids: [31] ) ] spids: [31] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:SUBDIRECTORY_OK) op:Equal rhs:{(Yes)} spids:[36])] spids: [36] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:NONGIT_OK) op:Equal rhs:{(Yes)} spids:[39])] spids: [39] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:OPTIONS_SPEC) op:Equal rhs:{(SQ )} spids:[42])] spids: [42] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:TOOL_MODE) op:Equal rhs:{(merge)} spids:[44])] spids: [44] ) (C {(.)} {(git-sh-setup)}) (C {(.)} {(git-mergetool--lib)}) (FuncDef name: is_symlink body: (BraceGroup children: [(C {(test)} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(120000)})] spids: [64] ) spids: [59 63] ) (FuncDef name: is_submodule body: (BraceGroup children: [(C {(test)} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(160000)})] spids: [85] ) spids: [80 84] ) (FuncDef name: local_present body: (BraceGroup children: [(C {(test)} {(-n)} {(DQ ($ VSub_Name "$local_mode"))})] spids: [106] ) spids: [101 105] ) (FuncDef name: remote_present body: (BraceGroup children: [(C {(test)} {(-n)} {(DQ ($ VSub_Name "$remote_mode"))})] spids: [125] ) spids: [120 124] ) (FuncDef name: base_present body: (BraceGroup children:[(C {(test)} {(-n)} {(DQ ($ VSub_Name "$base_mode"))})] spids:[144]) spids: [139 143] ) (FuncDef name: mergetool_tmpdir_init body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (C {(test)} { (DQ (CommandSubPart command_list: (CommandList children: [(C {(git)} {(config)} {(--bool)} {(mergetool.writeToTemp)})] ) left_token: spids: [171 179] ) ) } {(KW_Bang "!") (Lit_Other "=")} {(true)} ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:MERGETOOL_TMPDIR) op: Equal rhs: {(.)} spids: [191] ) ] spids: [191] ) (ControlFlow token: arg_word:{(0)}) ] spids: [-1 188] ) ] spids: [-1 200] ) (If arms: [ (if_arm cond: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:MERGETOOL_TMPDIR) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [{(mktemp)} {(-d)} {(-t)} {(DQ (git-mergetool-XXXXXX))}] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [217] ) ] ) ] ) left_token: spids: [206 219] ) } spids: [205] ) ] spids: [205] ) ] action: [(ControlFlow token: arg_word:{(0)})] spids: [-1 222] ) ] spids: [-1 230] ) (C {(die)} {(DQ ("error: mktemp is needed when 'mergetool.writeToTemp' is true"))}) ] spids: [163] ) spids: [158 162] ) (FuncDef name: cleanup_temp_files body: (BraceGroup children: [ (If arms: [ (if_arm cond: [(C {(test)} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(--save-backup)})] action: [ (C {(rm)} {(-rf)} {(--)} {(DQ ($ VSub_Name "$MERGED") (.orig))}) (AndOr children: [ (C {(test)} {(-e)} {(DQ ($ VSub_Name "$BACKUP"))}) (C {(mv)} {(--)} {(DQ ($ VSub_Name "$BACKUP"))} {(DQ ($ VSub_Name "$MERGED") (.orig))} ) ] op_id: Op_DAmp ) (C {(rm)} {(-f)} {(--)} {(DQ ($ VSub_Name "$LOCAL"))} {(DQ ($ VSub_Name "$REMOTE"))} {(DQ ($ VSub_Name "$BASE"))} ) ] spids: [-1 263] ) ] else_action: [ (C {(rm)} {(-f)} {(--)} {(DQ ($ VSub_Name "$LOCAL"))} {(DQ ($ VSub_Name "$REMOTE"))} {(DQ ($ VSub_Name "$BASE"))} {(DQ ($ VSub_Name "$BACKUP"))} ) ] spids: [321 347] ) (If arms: [ (if_arm cond: [ (C {(test)} {(DQ ($ VSub_Name "$MERGETOOL_TMPDIR"))} {(KW_Bang "!") (Lit_Other "=")} {(DQ (.))} ) ] action: [(C {(rmdir)} {(DQ ($ VSub_Name "$MERGETOOL_TMPDIR"))})] spids: [-1 366] ) ] spids: [-1 376] ) ] spids: [247] ) spids: [242 246] ) (FuncDef name: describe_file body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:mode) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [389] ) ] spids: [389] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:branch) op: Equal rhs: {(DQ ($ VSub_Number "$2"))} spids: [395] ) ] spids: [395] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:file) op: Equal rhs: {(DQ ($ VSub_Number "$3"))} spids: [401] ) ] spids: [401] ) (C {(printf)} {(DQ (" {%s}: "))} {(DQ ($ VSub_Name "$branch"))}) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$mode"))})] action: [(C {(echo)} {(DQ (deleted))})] spids: [-1 430] ) (if_arm cond: [(C {(is_symlink)} {(DQ ($ VSub_Name "$mode"))})] action: [ (C {(echo)} { (DQ ("a symbolic link -> '") (CommandSubPart command_list: (CommandList children: [(C {(cat)} {(DQ ($ VSub_Name "$file"))})] ) left_token: spids: [456 462] ) ("'") ) } ) ] spids: [440 449] ) (if_arm cond: [(C {(is_submodule)} {(DQ ($ VSub_Name "$mode"))})] action: [(C {(echo)} {(DQ ("submodule commit ") ($ VSub_Name "$file"))})] spids: [467 476] ) (if_arm cond: [(C {(base_present)})] action: [(C {(echo)} {(DQ ("modified file"))})] spids: [487 492] ) ] else_action: [(C {(echo)} {(DQ ("created file"))})] spids: [502 512] ) ] spids: [386] ) spids: [381 385] ) (FuncDef name: resolve_symlink_merge body: (BraceGroup children: [ (While cond: [(C {(true)})] body: (DoGroup children: [ (C {(printf)} {(DQ ("Use (l)ocal or (r)emote, or (a)bort? "))}) (AndOr children: [ (C {(read)} {(ans)}) (ControlFlow token: arg_word: {(1)} ) ] op_id: Op_DPipe ) (Case to_match: {(DQ ($ VSub_Name "$ans"))} arms: [ (case_arm pat_list: [{(Lit_Other "[") (lL) (Lit_Other "]") (Lit_Other "*")}] action: [ (C {(git)} {(checkout-index)} {(-f)} {(--stage) (Lit_Other "=") (2)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} ) (C {(git)} {(add)} {(--)} {(DQ ($ VSub_Name "$MERGED"))}) (C {(cleanup_temp_files)} {(--save-backup)}) (ControlFlow token: arg_word: {(0)} ) ] spids: [560 564 605 -1] ) (case_arm pat_list: [{(Lit_Other "[") (rR) (Lit_Other "]") (Lit_Other "*")}] action: [ (C {(git)} {(checkout-index)} {(-f)} {(--stage) (Lit_Other "=") (3)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} ) (C {(git)} {(add)} {(--)} {(DQ ($ VSub_Name "$MERGED"))}) (C {(cleanup_temp_files)} {(--save-backup)}) (ControlFlow token: arg_word: {(0)} ) ] spids: [608 612 653 -1] ) (case_arm pat_list: [{(Lit_Other "[") (aA) (Lit_Other "]") (Lit_Other "*")}] action: [(ControlFlow token: arg_word:{(1)})] spids: [656 660 668 -1] ) ] spids: [551 557 671] ) ] spids: [530 674] ) ) ] spids: [522] ) spids: [517 521] ) (FuncDef name: resolve_deleted_merge body: (BraceGroup children: [ (While cond: [(C {(true)})] body: (DoGroup children: [ (If arms: [ (if_arm cond: [(C {(base_present)})] action: [ (C {(printf)} {(DQ ("Use (m)odified or (d)eleted file, or (a)bort? "))}) ] spids: [-1 700] ) ] else_action: [ (C {(printf)} {(DQ ("Use (c)reated or (d)eleted file, or (a)bort? "))}) ] spids: [710 720] ) (AndOr children: [ (C {(read)} {(ans)}) (ControlFlow token: arg_word: {(1)} ) ] op_id: Op_DPipe ) (Case to_match: {(DQ ($ VSub_Name "$ans"))} arms: [ (case_arm pat_list: [{(Lit_Other "[") (mMcC) (Lit_Other "]") (Lit_Other "*")}] action: [ (C {(git)} {(add)} {(--)} {(DQ ($ VSub_Name "$MERGED"))}) (If arms: [ (if_arm cond: [ (C {(test)} {(DQ ($ VSub_Name "$merge_keep_backup"))} {(Lit_Other "=")} {(DQ (true))} ) ] action: [(C {(cleanup_temp_files)} {(--save-backup)})] spids: [-1 776] ) ] else_action: [(C {(cleanup_temp_files)})] spids: [784 790] ) (ControlFlow token: arg_word: {(0)} ) ] spids: [743 747 798 -1] ) (case_arm pat_list: [{(Lit_Other "[") (dD) (Lit_Other "]") (Lit_Other "*")}] action: [ (SimpleCommand words: [{(git)} {(rm)} {(--)} {(DQ ($ VSub_Name "$MERGED"))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [818] ) ] ) (C {(cleanup_temp_files)}) (ControlFlow token: arg_word: {(0)} ) ] spids: [801 805 831 -1] ) (case_arm pat_list: [{(Lit_Other "[") (aA) (Lit_Other "]") (Lit_Other "*")}] action: [ (If arms: [ (if_arm cond: [ (C {(test)} {(DQ ($ VSub_Name "$merge_keep_temporaries"))} {(Lit_Other "=")} {(DQ (false))} ) ] action: [(C {(cleanup_temp_files)})] spids: [-1 856] ) ] spids: [-1 862] ) (ControlFlow token: arg_word: {(1)} ) ] spids: [834 838 870 -1] ) ] spids: [734 740 873] ) ] spids: [692 876] ) ) ] spids: [684] ) spids: [679 683] ) (FuncDef name: resolve_submodule_merge body: (BraceGroup children: [ (While cond: [(C {(true)})] body: (DoGroup children: [ (C {(printf)} {(DQ ("Use (l)ocal or (r)emote, or (a)bort? "))}) (AndOr children: [ (C {(read)} {(ans)}) (ControlFlow token: arg_word: {(1)} ) ] op_id: Op_DPipe ) (Case to_match: {(DQ ($ VSub_Name "$ans"))} arms: [ (case_arm pat_list: [{(Lit_Other "[") (lL) (Lit_Other "]") (Lit_Other "*")}] action: [ (If arms: [ (if_arm cond: [(Pipeline children:[(C {(local_present)})] negated:True)] action: [ (If arms: [ (if_arm cond: [ (C {(test)} {(-n)} { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(ls-tree)} {(HEAD)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} ) ] ) left_token: spids: [948 960] ) ) } ) ] action: [ (AndOr children: [ (Pipeline children: [ (C {(git)} {(ls-tree)} {(--full-name)} {(-r)} {(HEAD)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} ) (C {(git)} {(update-index)} {(--index-info)}) ] negated: False ) (C {(exit)} {($ VSub_QMark "$?")}) ] op_id: Op_DPipe ) ] spids: [-1 964] ) ] else_action: [ (AndOr children: [ (C {(test)} {(-e)} {(DQ ($ VSub_Name "$MERGED"))}) (C {(mv)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} {(DQ ($ VSub_Name "$BACKUP"))} ) ] op_id: Op_DAmp ) (C {(git)} {(update-index)} {(--force-remove)} {(DQ ($ VSub_Name "$MERGED"))} ) (C {(cleanup_temp_files)} {(--save-backup)}) ] spids: [1003 1045] ) ] spids: [-1 938] ) (if_arm cond: [(C {(is_submodule)} {(DQ ($ VSub_Name "$local_mode"))})] action: [ (C {(stage_submodule)} {(DQ ($ VSub_Name "$MERGED"))} {(DQ ($ VSub_Name "$local_sha1"))} ) ] spids: [1048 1057] ) ] else_action: [ (C {(git)} {(checkout-index)} {(-f)} {(--stage) (Lit_Other "=") (2)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} ) (C {(git)} {(add)} {(--)} {(DQ ($ VSub_Name "$MERGED"))}) ] spids: [1071 1102] ) (ControlFlow token: arg_word: {(0)} ) ] spids: [924 928 1110 -1] ) (case_arm pat_list: [{(Lit_Other "[") (rR) (Lit_Other "]") (Lit_Other "*")}] action: [ (If arms: [ (if_arm cond: [(Pipeline children:[(C {(remote_present)})] negated:True)] action: [ (If arms: [ (if_arm cond: [ (C {(test)} {(-n)} { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(ls-tree)} {(MERGE_HEAD)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} ) ] ) left_token: spids: [1137 1149] ) ) } ) ] action: [ (AndOr children: [ (Pipeline children: [ (C {(git)} {(ls-tree)} {(--full-name)} {(-r)} {(MERGE_HEAD)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} ) (C {(git)} {(update-index)} {(--index-info)}) ] negated: False ) (C {(exit)} {($ VSub_QMark "$?")}) ] op_id: Op_DPipe ) ] spids: [-1 1153] ) ] else_action: [ (AndOr children: [ (C {(test)} {(-e)} {(DQ ($ VSub_Name "$MERGED"))}) (C {(mv)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} {(DQ ($ VSub_Name "$BACKUP"))} ) ] op_id: Op_DAmp ) (C {(git)} {(update-index)} {(--force-remove)} {(DQ ($ VSub_Name "$MERGED"))} ) ] spids: [1192 1229] ) ] spids: [-1 1127] ) (if_arm cond: [(C {(is_submodule)} {(DQ ($ VSub_Name "$remote_mode"))})] action: [ (AndOr children: [ (Pipeline children: [ (C {(is_submodule)} {(DQ ($ VSub_Name "$local_mode"))}) ] negated: True ) (AndOr children: [ (C {(test)} {(-e)} {(DQ ($ VSub_Name "$MERGED"))}) (C {(mv)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} {(DQ ($ VSub_Name "$BACKUP"))} ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) (C {(stage_submodule)} {(DQ ($ VSub_Name "$MERGED"))} {(DQ ($ VSub_Name "$remote_sha1"))} ) ] spids: [1232 1241] ) ] else_action: [ (AndOr children: [ (C {(test)} {(-e)} {(DQ ($ VSub_Name "$MERGED"))}) (C {(mv)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} {(DQ ($ VSub_Name "$BACKUP"))} ) ] op_id: Op_DAmp ) (C {(git)} {(checkout-index)} {(-f)} {(--stage) (Lit_Other "=") (3)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} ) (C {(git)} {(add)} {(--)} {(DQ ($ VSub_Name "$MERGED"))}) ] spids: [1290 1344] ) (C {(cleanup_temp_files)} {(--save-backup)}) (ControlFlow token: arg_word: {(0)} ) ] spids: [1113 1117 1357 -1] ) (case_arm pat_list: [{(Lit_Other "[") (aA) (Lit_Other "]") (Lit_Other "*")}] action: [(ControlFlow token: arg_word:{(1)})] spids: [1360 1364 1372 -1] ) ] spids: [915 921 1375] ) ] spids: [894 1378] ) ) ] spids: [886] ) spids: [881 885] ) (FuncDef name: stage_submodule body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:path) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [1391] ) ] spids: [1391] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:submodule_sha1) op: Equal rhs: {(DQ ($ VSub_Number "$2"))} spids: [1397] ) ] spids: [1397] ) (AndOr children: [ (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name "$path"))}) (C {(die)} {(DQ ("fatal: unable to create directory for module at ") ($ VSub_Name "$path"))} ) ] op_id: Op_DPipe ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:work_tree_root) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (AndOr children: [(C {(cd_to_toplevel)}) (C {(pwd)})] op_id: Op_DAmp ) ] ) left_token: spids: [1427 1433] ) } spids: [1426] ) ] spids: [1426] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:work_rel_path) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (AndOr children: [ (C {(cd)} {(DQ ($ VSub_Name "$path"))}) (SimpleCommand words: [{(git)} {(rev-parse)} {(--show-prefix)}] more_env: [ (env_pair name: GIT_WORK_TREE val: {(DQ (${ VSub_Name work_tree_root))} spids: [1447] ) ] ) ] op_id: Op_DAmp ) ] ) left_token: spids: [1437 1461] ) } spids: [1436] ) ] spids: [1436] ) (AndOr children: [ (C {(test)} {(-n)} {(DQ ($ VSub_Name "$work_rel_path"))}) (C {(die)} { (DQ ("fatal: unable to get path of module ") ($ VSub_Name "$path") (" relative to work tree") ) } ) ] op_id: Op_DPipe ) (AndOr children: [ (C {(git)} {(update-index)} {(--add)} {(--replace)} {(--cacheinfo)} {(160000)} {(DQ ($ VSub_Name "$submodule_sha1"))} { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /)}) spids: [1501 1505] ) ) } ) (C {(die)}) ] op_id: Op_DPipe ) ] spids: [1388] ) spids: [1383 1387] ) (FuncDef name: checkout_staged_file body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tmpfile) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(expr)} { (DQ (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(git)} {(checkout-index)} {(--temp)} {(--stage) (Lit_Other "=") (DQ ($ VSub_Number "$1"))} {(DQ ($ VSub_Number "$2"))} ] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [1547] ) ] ) ] ) left_token: spids: [1530 1549] ) ) } {(Lit_Other ":")} {(SQ <"\\([^\t]*\\)\t">)} ) ] ) left_token: spids: [1524 1559] ) } spids: [1523] ) ] spids: [1523] ) (If arms: [ (if_arm cond: [ (AndOr children: [ (C {(test)} {($ VSub_QMark "$?")} {(-eq)} {(0)}) (C {(test)} {(-n)} {(DQ ($ VSub_Name "$tmpfile"))}) ] op_id: Op_DAmp ) ] action: [ (C {(mv)} {(--)} { (DQ (CommandSubPart command_list: (CommandList children: [(C {(git)} {(rev-parse)} {(--show-cdup)})] ) left_token: spids: [1592 1598] ) ($ VSub_Name "$tmpfile") ) } {(DQ ($ VSub_Number "$3"))} ) ] spids: [-1 1584] ) ] else_action: [ (SimpleCommand redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Number "$3"))} spids: [1610] ) ] ) ] spids: [1607 1616] ) ] spids: [1520] ) spids: [1515 1519] ) (FuncDef name: merge_file body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:MERGED) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [1629] ) ] spids: [1629] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:f) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(ls-files)} {(-u)} {(--)} {(DQ ($ VSub_Name "$MERGED"))}) ] ) left_token: spids: [1637 1649] ) } spids: [1636] ) ] spids: [1636] ) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$f"))})] action: [ (If arms: [ (if_arm cond: [(C {(test)} {(KW_Bang "!")} {(-f)} {(DQ ($ VSub_Name "$MERGED"))})] action: [(C {(echo)} {(DQ ($ VSub_Name "$MERGED") (": file not found"))})] spids: [-1 1679] ) ] else_action: [ (C {(echo)} {(DQ ($ VSub_Name "$MERGED") (": file does not need merging"))}) ] spids: [1690 1701] ) (ControlFlow token: arg_word:{(1)}) ] spids: [-1 1663] ) ] spids: [-1 1709] ) (If arms: [ (if_arm cond: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BASE) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(expr)} {(DQ ($ VSub_Name "$MERGED"))} {(Lit_Other ":")} {(SQ <"\\(.*\\)\\.[^/]*$">)} ) ] ) left_token: spids: [1716 1728] ) } spids: [1715] ) ] spids: [1715] ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ext) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(expr)} {(DQ ($ VSub_Name "$MERGED"))} {(Lit_Other ":")} {(SQ <".*\\(\\.[^/]*\\)$">)} ) ] ) left_token: spids: [1735 1747] ) } spids: [1734] ) ] spids: [1734] ) ] spids: [-1 1731] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BASE) op: Equal rhs: {($ VSub_Name "$MERGED")} spids: [1753] ) ] spids: [1753] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:ext) op:Equal rhs:{(SQ )} spids:[1757])] spids: [1757] ) ] spids: [1750 1760] ) (C {(mergetool_tmpdir_init)}) (If arms: [ (if_arm cond: [ (C {(test)} {(DQ ($ VSub_Name "$MERGETOOL_TMPDIR"))} {(KW_Bang "!") (Lit_Other "=")} {(DQ (.))} ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BASE) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id: VOp1_DPound arg_word: {("*") (Lit_Slash /)} ) spids: [1796 1801] ) } spids: [1795] ) ] spids: [1795] ) ] spids: [-1 1784] ) ] spids: [-1 1804] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BACKUP) op: Equal rhs: { (DQ ($ VSub_Name "$MERGETOOL_TMPDIR") (/) (${ VSub_Name BASE) (_BACKUP_) ($ VSub_Dollar "$$") ($ VSub_Name "$ext") ) } spids: [1808] ) ] spids: [1808] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOCAL) op: Equal rhs: { (DQ ($ VSub_Name "$MERGETOOL_TMPDIR") (/) (${ VSub_Name BASE) (_LOCAL_) ($ VSub_Dollar "$$") ($ VSub_Name "$ext") ) } spids: [1821] ) ] spids: [1821] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REMOTE) op: Equal rhs: { (DQ ($ VSub_Name "$MERGETOOL_TMPDIR") (/) (${ VSub_Name BASE) (_REMOTE_) ($ VSub_Dollar "$$") ($ VSub_Name "$ext") ) } spids: [1834] ) ] spids: [1834] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BASE) op: Equal rhs: { (DQ ($ VSub_Name "$MERGETOOL_TMPDIR") (/) (${ VSub_Name BASE) (_BASE_) ($ VSub_Dollar "$$") ($ VSub_Name "$ext") ) } spids: [1847] ) ] spids: [1847] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:base_mode) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(git)} {(ls-files)} {(-u)} {(--)} {(DQ ($ VSub_Name "$MERGED"))}) (C {(awk)} {(SQ <"{if ($3==1) print $1;}">)}) ] negated: False ) ] ) left_token: spids: [1862 1882] ) } spids: [1861] ) ] spids: [1861] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:local_mode) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(git)} {(ls-files)} {(-u)} {(--)} {(DQ ($ VSub_Name "$MERGED"))}) (C {(awk)} {(SQ <"{if ($3==2) print $1;}">)}) ] negated: False ) ] ) left_token: spids: [1886 1906] ) } spids: [1885] ) ] spids: [1885] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:remote_mode) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(git)} {(ls-files)} {(-u)} {(--)} {(DQ ($ VSub_Name "$MERGED"))}) (C {(awk)} {(SQ <"{if ($3==3) print $1;}">)}) ] negated: False ) ] ) left_token: spids: [1910 1930] ) } spids: [1909] ) ] spids: [1909] ) (If arms: [ (if_arm cond: [ (AndOr children: [ (C {(is_submodule)} {(DQ ($ VSub_Name "$local_mode"))}) (C {(is_submodule)} {(DQ ($ VSub_Name "$remote_mode"))}) ] op_id: Op_DPipe ) ] action: [ (C {(echo)} {(DQ ("Submodule merge conflict for '") ($ VSub_Name "$MERGED") ("':"))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:local_sha1) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(git)} {(ls-files)} {(-u)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} ) (C {(awk)} {(SQ <"{if ($3==2) print $2;}">)}) ] negated: False ) ] ) left_token: spids: [1964 1984] ) } spids: [1963] ) ] spids: [1963] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:remote_sha1) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(git)} {(ls-files)} {(-u)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} ) (C {(awk)} {(SQ <"{if ($3==3) print $2;}">)}) ] negated: False ) ] ) left_token: spids: [1988 2008] ) } spids: [1987] ) ] spids: [1987] ) (C {(describe_file)} {(DQ ($ VSub_Name "$local_mode"))} {(DQ (local))} {(DQ ($ VSub_Name "$local_sha1"))} ) (C {(describe_file)} {(DQ ($ VSub_Name "$remote_mode"))} {(DQ (remote))} {(DQ ($ VSub_Name "$remote_sha1"))} ) (C {(resolve_submodule_merge)}) (ControlFlow token:) ] spids: [-1 1951] ) ] spids: [-1 2047] ) (If arms: [ (if_arm cond: [(C {(test)} {(-f)} {(DQ ($ VSub_Name "$MERGED"))})] action: [ (C {(mv)} {(--)} {(DQ ($ VSub_Name "$MERGED"))} {(DQ ($ VSub_Name "$BACKUP"))}) (C {(cp)} {(--)} {(DQ ($ VSub_Name "$BACKUP"))} {(DQ ($ VSub_Name "$MERGED"))}) ] spids: [-1 2062] ) ] spids: [-1 2091] ) (C {(mkdir)} {(-p)} { (DQ (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ ($ VSub_Name "$MERGED"))})] ) left_token: spids: [2107 2113] ) ) } ) (C {(checkout_staged_file)} {(1)} {(DQ ($ VSub_Name "$MERGED"))} {(DQ ($ VSub_Name "$BASE"))}) (C {(checkout_staged_file)} {(2)} {(DQ ($ VSub_Name "$MERGED"))} {(DQ ($ VSub_Name "$LOCAL"))}) (C {(checkout_staged_file)} {(3)} {(DQ ($ VSub_Name "$MERGED"))} {(DQ ($ VSub_Name "$REMOTE"))} ) (If arms: [ (if_arm cond: [ (AndOr children: [ (C {(test)} {(-z)} {(DQ ($ VSub_Name "$local_mode"))}) (C {(test)} {(-z)} {(DQ ($ VSub_Name "$remote_mode"))}) ] op_id: Op_DPipe ) ] action: [ (C {(echo)} {(DQ ("Deleted merge conflict for '") ($ VSub_Name "$MERGED") ("':"))}) (C {(describe_file)} {(DQ ($ VSub_Name "$local_mode"))} {(DQ (local))} {(DQ ($ VSub_Name "$LOCAL"))} ) (C {(describe_file)} {(DQ ($ VSub_Name "$remote_mode"))} {(DQ (remote))} {(DQ ($ VSub_Name "$REMOTE"))} ) (C {(resolve_deleted_merge)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:status) op: Equal rhs: {($ VSub_QMark "$?")} spids: [2224] ) ] spids: [2224] ) (SimpleCommand words: [ {(rmdir)} {(-p)} { (DQ (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ ($ VSub_Name "$MERGED"))})] ) left_token: spids: [2233 2239] ) ) } ] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[2242])] ) (ControlFlow token: arg_word: {($ VSub_Name "$status")} ) ] spids: [-1 2179] ) ] spids: [-1 2251] ) (If arms: [ (if_arm cond: [ (AndOr children: [ (C {(is_symlink)} {(DQ ($ VSub_Name "$local_mode"))}) (C {(is_symlink)} {(DQ ($ VSub_Name "$remote_mode"))}) ] op_id: Op_DPipe ) ] action: [ (C {(echo)} {(DQ ("Symbolic link merge conflict for '") ($ VSub_Name "$MERGED") ("':"))} ) (C {(describe_file)} {(DQ ($ VSub_Name "$local_mode"))} {(DQ (local))} {(DQ ($ VSub_Name "$LOCAL"))} ) (C {(describe_file)} {(DQ ($ VSub_Name "$remote_mode"))} {(DQ (remote))} {(DQ ($ VSub_Name "$REMOTE"))} ) (C {(resolve_symlink_merge)}) (ControlFlow token:) ] spids: [-1 2272] ) ] spids: [-1 2320] ) (C {(echo)} {(DQ ("Normal merge conflict for '") ($ VSub_Name "$MERGED") ("':"))}) (C {(describe_file)} {(DQ ($ VSub_Name "$local_mode"))} {(DQ (local))} {(DQ ($ VSub_Name "$LOCAL"))} ) (C {(describe_file)} {(DQ ($ VSub_Name "$remote_mode"))} {(DQ (remote))} {(DQ ($ VSub_Name "$REMOTE"))} ) (If arms: [ (if_arm cond: [ (AndOr children: [ (C {(test)} {(DQ ($ VSub_Name "$guessed_merge_tool"))} {(Lit_Other "=")} {(true)}) (C {(test)} {(DQ ($ VSub_Name "$prompt"))} {(Lit_Other "=")} {(true)}) ] op_id: Op_DPipe ) ] action: [ (C {(printf)} {(DQ ("Hit return to start merge resolution tool (%s): "))} {(DQ ($ VSub_Name "$merge_tool"))} ) (AndOr children: [ (C {(read)} {(ans)}) (ControlFlow token: arg_word: {(1)} ) ] op_id: Op_DPipe ) ] spids: [-1 2388] ) ] spids: [-1 2413] ) (If arms: [ (if_arm cond: [(C {(base_present)})] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:present) op: Equal rhs: {(true)} spids: [2425] ) ] spids: [2425] ) ] spids: [-1 2422] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:present) op: Equal rhs: {(false)} spids: [2432] ) ] spids: [2432] ) ] spids: [2429 2436] ) (If arms: [ (if_arm cond: [ (Pipeline children: [ (C {(run_merge_tool)} {(DQ ($ VSub_Name "$merge_tool"))} {(DQ ($ VSub_Name "$present"))} ) ] negated: True ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ("merge of ") ($ VSub_Name "$MERGED") (" failed"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:1 arg_word:{(2)} spids:[2466])] ) (C {(mv)} {(--)} {(DQ ($ VSub_Name "$BACKUP"))} {(DQ ($ VSub_Name "$MERGED"))}) (If arms: [ (if_arm cond: [ (C {(test)} {(DQ ($ VSub_Name "$merge_keep_temporaries"))} {(Lit_Other "=")} {(DQ (false))} ) ] action: [(C {(cleanup_temp_files)})] spids: [-1 2499] ) ] spids: [-1 2505] ) (ControlFlow token: arg_word:{(1)}) ] spids: [-1 2455] ) ] spids: [-1 2514] ) (If arms: [ (if_arm cond: [ (C {(test)} {(DQ ($ VSub_Name "$merge_keep_backup"))} {(Lit_Other "=")} {(DQ (true))}) ] action: [ (C {(mv)} {(--)} {(DQ ($ VSub_Name "$BACKUP"))} {(DQ ($ VSub_Name "$MERGED") (.orig))}) ] spids: [-1 2533] ) ] else_action: [(C {(rm)} {(--)} {(DQ ($ VSub_Name "$BACKUP"))})] spids: [2550 2562] ) (C {(git)} {(add)} {(--)} {(DQ ($ VSub_Name "$MERGED"))}) (C {(cleanup_temp_files)}) (ControlFlow token: arg_word:{(0)}) ] spids: [1626] ) spids: [1621 1625] ) (FuncDef name: prompt_after_failed_merge body: (BraceGroup children: [ (While cond: [(C {(true)})] body: (DoGroup children: [ (C {(printf)} {(DQ ("Continue merging other unresolved paths [y/n]? "))}) (AndOr children: [ (C {(read)} {(ans)}) (ControlFlow token: arg_word: {(1)} ) ] op_id: Op_DPipe ) (Case to_match: {(DQ ($ VSub_Name "$ans"))} arms: [ (case_arm pat_list: [{(Lit_Other "[") (yY) (Lit_Other "]") (Lit_Other "*")}] action: [(ControlFlow token: arg_word:{(0)})] spids: [2630 2634 2642 -1] ) (case_arm pat_list: [{(Lit_Other "[") (nN) (Lit_Other "]") (Lit_Other "*")}] action: [(ControlFlow token: arg_word:{(1)})] spids: [2645 2649 2657 -1] ) ] spids: [2621 2627 2660] ) ] spids: [2600 2663] ) ) ] spids: [2592] ) spids: [2587 2591] ) (FuncDef name: print_noop_and_exit body: (BraceGroup children: [(C {(echo)} {(DQ ("No files need merging"))}) (C {(exit)} {(0)})] spids: [2673] ) spids: [2668 2672] ) (FuncDef name: main body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:prompt) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(git)} {(config)} {(--bool)} {(mergetool.prompt)})] ) left_token: spids: [2699 2707] ) } spids: [2698] ) ] spids: [2698] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:guessed_merge_tool) op: Equal rhs: {(false)} spids: [2710] ) ] spids: [2710] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:orderfile) op:Equal rhs:{(SQ )} spids:[2714])] spids: [2714] ) (While cond: [(C {(test)} {($ VSub_Pound "$#")} {(KW_Bang "!") (Lit_Other "=")} {(0)})] body: (DoGroup children: [ (Case to_match: {(DQ ($ VSub_Number "$1"))} arms: [ (case_arm pat_list: [{(--tool-help) (Lit_Other "=") (Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TOOL_MODE) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id: VOp1_Pound arg_word: {("--tool-help=")} ) spids: [2749 2753] ) } spids: [2748] ) ] spids: [2748] ) (C {(show_tool_help)}) ] spids: [2742 2745 2759 -1] ) (case_arm pat_list: [{(--tool-help)}] action: [(C {(show_tool_help)})] spids: [2762 2763 2769 -1] ) (case_arm pat_list: [{(-t)} {(--tool) (Lit_Other "*")}] action: [ (Case to_match: {(DQ ($ VSub_Pound "$#") (",") ($ VSub_Number "$1"))} arms: [ (case_arm pat_list: [ {(Lit_Other "*") (Lit_Comma ",") (Lit_Other "*") (Lit_Other "=") (Lit_Other "*") } ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:merge_tool) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(expr)} {(DQ (z) ($ VSub_Number "$1"))} {(Lit_Other ":")} {(SQ <"z-[^=]*=\\(.*\\)">)} ) ] ) left_token: spids: [2799 2812] ) } spids: [2798] ) ] spids: [2798] ) ] spids: [2790 2795 2815 -1] ) (case_arm pat_list: [{(1) (Lit_Comma ",") (Lit_Other "*")}] action: [(C {(usage)})] spids: [2818 2821 2826 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:merge_tool) op: Equal rhs: {(DQ ($ VSub_Number "$2"))} spids: [2833] ) ] spids: [2833] ) (C {(shift)}) ] spids: [2829 2830 2841 -1] ) ] spids: [2779 2787 2844] ) ] spids: [2772 2776 2847 -1] ) (case_arm pat_list: [{(-y)} {(--no-prompt)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:prompt) op: Equal rhs: {(false)} spids: [2856] ) ] spids: [2856] ) ] spids: [2850 2853 2860 -1] ) (case_arm pat_list: [{(--prompt)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:prompt) op: Equal rhs: {(true)} spids: [2867] ) ] spids: [2867] ) ] spids: [2863 2864 2871 -1] ) (case_arm pat_list: [{(-O) (Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:orderfile) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [2879] ) ] spids: [2879] ) ] spids: [2874 2876 2885 -1] ) (case_arm pat_list: [{(--)}] action: [(C {(shift)}) (ControlFlow token:)] spids: [2888 2889 2898 -1] ) (case_arm pat_list: [{(-) (Lit_Other "*")}] action: [(C {(usage)})] spids: [2901 2903 2909 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [(ControlFlow token:)] spids: [2912 2913 2919 -1] ) ] spids: [2733 2739 2922] ) (C {(shift)}) ] spids: [2730 2928] ) ) (C {(git_dir_init)}) (C {(require_work_tree)}) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$merge_tool"))})] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:merge_tool) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(get_configured_merge_tool)})] ) left_token: spids: [2958 2960] ) } spids: [2957] ) ] spids: [2957] ) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$merge_tool"))})] action: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:merge_tool) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(guess_merge_tool)})] ) left_token: spids: [2982 2984] ) } spids: [2981] ) ] spids: [2981] ) (C {(exit)}) ] op_id: Op_DPipe ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:guessed_merge_tool) op: Equal rhs: {(true)} spids: [2991] ) ] spids: [2991] ) ] spids: [-1 2978] ) ] spids: [-1 2995] ) ] spids: [-1 2950] ) ] spids: [-1 2998] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:merge_keep_backup) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (AndOr children: [ (C {(git)} {(config)} {(--bool)} {(mergetool.keepBackup)}) (C {(echo)} {(true)}) ] op_id: Op_DPipe ) ] ) left_token: spids: [3003 3017] ) ) } spids: [3001] ) ] spids: [3001] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:merge_keep_temporaries) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (AndOr children: [ (C {(git)} {(config)} {(--bool)} {(mergetool.keepTemporaries)}) (C {(echo)} {(false)}) ] op_id: Op_DPipe ) ] ) left_token: spids: [3023 3037] ) ) } spids: [3021] ) ] spids: [3021] ) (If arms: [ (if_arm cond: [ (AndOr children: [ (C {(test)} {($ VSub_Pound "$#")} {(-eq)} {(0)}) (C {(test)} {(-e)} {(DQ ($ VSub_Name "$GIT_DIR") (/MERGE_RR))}) ] op_id: Op_DAmp ) ] action: [ (C {(set)} {(--)} { (CommandSubPart command_list: (CommandList children:[(C {(git)} {(rerere)} {(remaining)})]) left_token: spids: [3071 3077] ) } ) (If arms: [ (if_arm cond: [(C {(test)} {($ VSub_Pound "$#")} {(-eq)} {(0)})] action: [(C {(print_noop_and_exit)})] spids: [-1 3091] ) ] spids: [-1 3097] ) ] spids: [-1 3064] ) ] spids: [-1 3100] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:files) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(-c)} {(core.quotePath) (Lit_Other "=") (false)} {(diff)} {(--name-only)} {(--diff-filter) (Lit_Other "=") (U)} { (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonPlus arg_word: {(DQ ($ VSub_Name "$orderfile"))} ) spids: [3126 3132] ) } {(--)} {(DQ ($ VSub_At "$@"))} ) ] ) left_token: spids: [3105 3139] ) } spids: [3104] ) ] spids: [3104] ) (C {(cd_to_toplevel)}) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$files"))})] action: [(C {(print_noop_and_exit)})] spids: [-1 3158] ) ] spids: [-1 3164] ) (C {(printf)} {(DQ ("Merging:") (EscapedLiteralPart token:))}) (C {(printf)} {(DQ ("%s") (EscapedLiteralPart token:))} {(DQ ($ VSub_Name "$files"))} ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(0)} spids:[3189])] spids: [3189] ) (ForEach iter_name: i iter_words: [{($ VSub_Name "$files")}] do_arg_iter: False body: (DoGroup children: [ (C {(printf)} {(DQ (EscapedLiteralPart token:))}) (If arms: [ (if_arm cond: [ (Pipeline children: [(C {(merge_file)} {(DQ ($ VSub_Name "$i"))})] negated: True ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:rc) op: Equal rhs: {(1)} spids: [3226] ) ] spids: [3226] ) (AndOr children: [(C {(prompt_after_failed_merge)}) (C {(exit)} {(1)})] op_id: Op_DPipe ) ] spids: [-1 3223] ) ] spids: [-1 3239] ) ] spids: [3202 3242] ) spids: [3198 -1] ) (C {(exit)} {($ VSub_Name "$rc")}) ] spids: [2695] ) spids: [2690 2694] ) (C {(main)} {(DQ ($ VSub_At "$@"))}) ] )