(command.CommandList children: [ (command.ShFunction name: check body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:credential_opts) op: assign_op.Equal rhs: (word.Empty) spids: [20] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:credential_cmd) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [23] ) ] ) (C {<shift>}) (command.ForEach iter_names: [arg] iterable: (for_iter.Words words:[{(DQ ($ Id.VSub_At '$@'))}]) body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:credential_opts) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName '$credential_opts') <' -c credential.helper=\''> ($ Id.VSub_DollarName '$arg') <'\''> ) } spids: [44] ) ] ) ] ) ) (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.Simple words: [{<read_chunk>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<stdin>})] do_fork: T ) (command.Simple words: [{<read_chunk>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<expect-stdout>} ) ] do_fork: T ) (command.Simple words: [{<read_chunk>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<expect-stderr>} ) ] do_fork: T ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Pipeline children: [ (C {<eval>} { (DQ <'git '> ($ Id.VSub_DollarName '$credential_opts') <' credential '> ($ Id.VSub_DollarName '$credential_cmd') <' <stdin >stdout 2>stderr'> ) } ) ] negated: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (C {<echo>} {(DQ <'git credential failed with code '> ($ Id.VSub_QMark '$?'))} ) (C {<cat>} {<stderr>}) (C {<false>}) ] ) ] spids: [80 95] ) ] ) (C {<test_cmp>} {<expect-stdout>} {<stdout>}) (C {<test_cmp>} {<expect-stderr>} {<stderr>}) ] ) ] ) ) (command.ShFunction name: read_chunk body: (BraceGroup children: [ (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [(command.Sentence child:(C {<read>} {<line>}) terminator:<Id.Op_Semi _>)] ) body: (command.DoGroup children: [ (command.Case to_match: {(DQ ($ Id.VSub_DollarName '$line'))} arms: [ (case_arm pat_list: [{<-->}] action: [(command.ControlFlow token:<Id.ControlFlow_Break break>)] spids: [167 168 172 -1] ) (case_arm pat_list: [{<Id.Lit_Star '*'>}] action: [(C {<echo>} {(DQ ($ Id.VSub_DollarName '$line'))})] spids: [175 176 184 -1] ) ] ) ] ) ) ] ) ) (command.ShFunction name: helper_test_clean body: (BraceGroup children: [ (C {<reject>} {($ Id.VSub_Number '$1')} {<https>} {<example.com>} {<store-user>}) (C {<reject>} {($ Id.VSub_Number '$1')} {<https>} {<example.com>} {<user1>}) (C {<reject>} {($ Id.VSub_Number '$1')} {<https>} {<example.com>} {<user2>}) (C {<reject>} {($ Id.VSub_Number '$1')} {<http>} {<path.tld>} {<user>}) (C {<reject>} {($ Id.VSub_Number '$1')} {<https>} {<timeout.tld>} {<user>}) ] ) ) (command.ShFunction name: reject body: (BraceGroup children: [ (command.Pipeline children: [ (command.Subshell child: (command.CommandList children: [ (C {<echo>} {<Id.Lit_VarLike 'protocol='> ($ Id.VSub_Number '$2')}) (C {<echo>} {<Id.Lit_VarLike 'host='> ($ Id.VSub_Number '$3')}) (C {<echo>} {<Id.Lit_VarLike 'username='> ($ Id.VSub_Number '$4')}) ] ) ) (C {<git>} {<-c>} {<credential.helper> <Id.Lit_Equals '='> ($ Id.VSub_Number '$1')} {<credential>} {<reject>} ) ] negated: F ) ] ) ) (command.ShFunction name: helper_test body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:HELPER) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [334] ) ] ) (C {<test_expect_success>} {(DQ <'helper ('> ($ Id.VSub_DollarName '$HELPER') <') has no existing data'>)} { (SQ <'\n'> <'\t\tcheck fill $HELPER <<-\\EOF\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\t--\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=askpass-username\n'> <'\t\tpassword=askpass-password\n'> <'\t\t--\n'> <'\t\taskpass: Username for '> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'https://example.com'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <':\n'> <'\t\taskpass: Password for '>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'https://askpass-username@example.com'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) (C {<test_expect_success>} {(DQ <'helper ('> ($ Id.VSub_DollarName '$HELPER') <') stores password'>)} { (SQ <'\n'> <'\t\tcheck approve $HELPER <<-\\EOF\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=store-user\n'> <'\t\tpassword=store-pass\n'> <'\t\tEOF\n'> <'\t'> ) } ) (C {<test_expect_success>} {(DQ <'helper ('> ($ Id.VSub_DollarName '$HELPER') <') can retrieve password'>)} { (SQ <'\n'> <'\t\tcheck fill $HELPER <<-\\EOF\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\t--\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=store-user\n'> <'\t\tpassword=store-pass\n'> <'\t\t--\n'> <'\t\tEOF\n'> <'\t'> ) } ) (C {<test_expect_success>} {(DQ <'helper ('> ($ Id.VSub_DollarName '$HELPER') <') requires matching protocol'>)} { (SQ <'\n'> <'\t\tcheck fill $HELPER <<-\\EOF\n'> <'\t\tprotocol=http\n'> <'\t\thost=example.com\n'> <'\t\t--\n'> <'\t\tprotocol=http\n'> <'\t\thost=example.com\n'> <'\t\tusername=askpass-username\n'> <'\t\tpassword=askpass-password\n'> <'\t\t--\n'> <'\t\taskpass: Username for '> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'http://example.com'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <':\n'> <'\t\taskpass: Password for '>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'http://askpass-username@example.com'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) (C {<test_expect_success>} {(DQ <'helper ('> ($ Id.VSub_DollarName '$HELPER') <') requires matching host'>)} { (SQ <'\n'> <'\t\tcheck fill $HELPER <<-\\EOF\n'> <'\t\tprotocol=https\n'> <'\t\thost=other.tld\n'> <'\t\t--\n'> <'\t\tprotocol=https\n'> <'\t\thost=other.tld\n'> <'\t\tusername=askpass-username\n'> <'\t\tpassword=askpass-password\n'> <'\t\t--\n'> <'\t\taskpass: Username for '> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'https://other.tld'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <':\n'> <'\t\taskpass: Password for '>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'https://askpass-username@other.tld'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) (C {<test_expect_success>} {(DQ <'helper ('> ($ Id.VSub_DollarName '$HELPER') <') requires matching username'>)} { (SQ <'\n'> <'\t\tcheck fill $HELPER <<-\\EOF\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=other\n'> <'\t\t--\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=other\n'> <'\t\tpassword=askpass-password\n'> <'\t\t--\n'> <'\t\taskpass: Password for '> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'https://other@example.com'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) (C {<test_expect_success>} {(DQ <'helper ('> ($ Id.VSub_DollarName '$HELPER') <') requires matching path'>)} { (SQ <'\n'> <'\t\ttest_config credential.usehttppath true &&\n'> <'\t\tcheck approve $HELPER <<-\\EOF &&\n'> <'\t\tprotocol=http\n'> <'\t\thost=path.tld\n'> <'\t\tpath=foo.git\n'> <'\t\tusername=user\n'> <'\t\tpassword=pass\n'> <'\t\tEOF\n'> <'\t\tcheck fill $HELPER <<-\\EOF\n'> <'\t\tprotocol=http\n'> <'\t\thost=path.tld\n'> <'\t\tpath=bar.git\n'> <'\t\t--\n'> <'\t\tprotocol=http\n'> <'\t\thost=path.tld\n'> <'\t\tpath=bar.git\n'> <'\t\tusername=askpass-username\n'> <'\t\tpassword=askpass-password\n'> <'\t\t--\n'> <'\t\taskpass: Username for '> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'http://path.tld/bar.git'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <':\n'> <'\t\taskpass: Password for '>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'http://askpass-username@path.tld/bar.git'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) (C {<test_expect_success>} {(DQ <'helper ('> ($ Id.VSub_DollarName '$HELPER') <') can forget host'>)} { (SQ <'\n'> <'\t\tcheck reject $HELPER <<-\\EOF &&\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tEOF\n'> <'\t\tcheck fill $HELPER <<-\\EOF\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\t--\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=askpass-username\n'> <'\t\tpassword=askpass-password\n'> <'\t\t--\n'> <'\t\taskpass: Username for '> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'https://example.com'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <':\n'> <'\t\taskpass: Password for '>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'https://askpass-username@example.com'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) (C {<test_expect_success>} {(DQ <'helper ('> ($ Id.VSub_DollarName '$HELPER') <') can store multiple users'>)} { (SQ <'\n'> <'\t\tcheck approve $HELPER <<-\\EOF &&\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=user1\n'> <'\t\tpassword=pass1\n'> <'\t\tEOF\n'> <'\t\tcheck approve $HELPER <<-\\EOF &&\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=user2\n'> <'\t\tpassword=pass2\n'> <'\t\tEOF\n'> <'\t\tcheck fill $HELPER <<-\\EOF &&\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=user1\n'> <'\t\t--\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=user1\n'> <'\t\tpassword=pass1\n'> <'\t\tEOF\n'> <'\t\tcheck fill $HELPER <<-\\EOF\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=user2\n'> <'\t\t--\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=user2\n'> <'\t\tpassword=pass2\n'> <'\t\tEOF\n'> <'\t'> ) } ) (C {<test_expect_success>} {(DQ <'helper ('> ($ Id.VSub_DollarName '$HELPER') <') can forget user'>)} { (SQ <'\n'> <'\t\tcheck reject $HELPER <<-\\EOF &&\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=user1\n'> <'\t\tEOF\n'> <'\t\tcheck fill $HELPER <<-\\EOF\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=user1\n'> <'\t\t--\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=user1\n'> <'\t\tpassword=askpass-password\n'> <'\t\t--\n'> <'\t\taskpass: Password for '> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'https://user1@example.com'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) (C {<test_expect_success>} {(DQ <'helper ('> ($ Id.VSub_DollarName '$HELPER') <') remembers other user'>)} { (SQ <'\n'> <'\t\tcheck fill $HELPER <<-\\EOF\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=user2\n'> <'\t\t--\n'> <'\t\tprotocol=https\n'> <'\t\thost=example.com\n'> <'\t\tusername=user2\n'> <'\t\tpassword=pass2\n'> <'\t\tEOF\n'> <'\t'> ) } ) ] ) ) (command.ShFunction name: helper_test_timeout body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:HELPER) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Star '$*'))} spids: [769] ) ] ) (C {<test_expect_success>} {(DQ <'helper ('> ($ Id.VSub_DollarName '$HELPER') <') times out'>)} { (SQ <'\n'> <'\t\tcheck approve "$HELPER" <<-\\EOF &&\n'> <'\t\tprotocol=https\n'> <'\t\thost=timeout.tld\n'> <'\t\tusername=user\n'> <'\t\tpassword=pass\n'> <'\t\tEOF\n'> <'\t\tsleep 2 &&\n'> <'\t\tcheck fill "$HELPER" <<-\\EOF\n'> <'\t\tprotocol=https\n'> <'\t\thost=timeout.tld\n'> <'\t\t--\n'> <'\t\tprotocol=https\n'> <'\t\thost=timeout.tld\n'> <'\t\tusername=askpass-username\n'> <'\t\tpassword=askpass-password\n'> <'\t\t--\n'> <'\t\taskpass: Username for '> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'https://timeout.tld'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <':\n'> <'\t\taskpass: Password for '>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'https://askpass-username@timeout.tld'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) ] ) ) (command.Simple words: [{<write_script>} {<askpass>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 838 stdin_parts: [ <'echo >&2 askpass: $*\n'> <'what=$(echo $1 | cut -d" " -f1 | tr A-Z a-z | tr -cd a-z)\n'> <'echo "askpass-$what"\n'> ] ) ) ] do_fork: T ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:GIT_ASKPASS) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$PWD') <'/askpass'>)} spids: [839] ) ] ) (C {<export>} {<GIT_ASKPASS>}) ] )