(command.CommandList children: [ (command.FuncDef name: check body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:credential_opts spids:[28]) op: Equal rhs: (word.EmptyWord) spids: [28] ) ] spids: [28] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:credential_cmd spids:[31]) op: Equal rhs: {($ VSub_Number '$1')} spids: [31] ) ] spids: [31] ) (C {(shift)}) (command.ForEach iter_name: arg iter_words: [{(DQ ($ VSub_At '$@'))}] do_arg_iter: F body: (command.DoGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:credential_opts spids:[52]) op: Equal rhs: { (DQ ($ VSub_Name '$credential_opts') (" -c credential.helper='") ($ VSub_Name '$arg') ("'") ) } spids: [52] ) ] spids: [52] ) ] spids: [49 61] ) spids: [43 47] ) (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (command.SimpleCommand words: [{(read_chunk)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(stdin)})] ) (command.SimpleCommand words: [{(read_chunk)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect-stdout)})] ) (command.SimpleCommand words: [{(read_chunk)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect-stderr)})] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [ (C {(eval)} { (DQ ('git ') ($ VSub_Name '$credential_opts') (' credential ') ($ VSub_Name '$credential_cmd') (' <stdin >stdout 2>stderr') ) } ) ] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (command.AndOr ops: [Op_DAmp Op_DAmp] children: [ (C {(echo)} {(DQ ('git credential failed with code ') ($ VSub_QMark '$?'))}) (C {(cat)} {(stderr)}) (C {(false)}) ] ) ] spids: [16777215 103] ) ] spids: [16777215 126] ) (C {(test_cmp)} {(expect-stdout)} {(stdout)}) (C {(test_cmp)} {(expect-stderr)} {(stderr)}) ] ) ] spids: [25] ) spids: [21 24] ) (command.FuncDef name: read_chunk body: (command.BraceGroup children: [ (command.WhileUntil keyword: <KW_While while> cond: [(command.Sentence child:(C {(read)} {(line)}) terminator:<Op_Semi ';'>)] body: (command.DoGroup children: [ (command.Case to_match: {(DQ ($ VSub_Name '$line'))} arms: [ (case_arm pat_list: [{(--)}] action: [(command.ControlFlow token:<ControlFlow_Break break>)] spids: [175 176 180 16777215] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [(C {(echo)} {(DQ ($ VSub_Name '$line'))})] spids: [183 184 192 16777215] ) ] spids: [166 172 195] ) ] spids: [163 198] ) ) ] spids: [153] ) spids: [149 152] ) (command.FuncDef name: helper_test_clean body: (command.BraceGroup children: [ (C {(reject)} {($ VSub_Number '$1')} {(https)} {(example.com)} {(store-user)}) (C {(reject)} {($ VSub_Number '$1')} {(https)} {(example.com)} {(user1)}) (C {(reject)} {($ VSub_Number '$1')} {(https)} {(example.com)} {(user2)}) (C {(reject)} {($ VSub_Number '$1')} {(http)} {(path.tld)} {(user)}) (C {(reject)} {($ VSub_Number '$1')} {(https)} {(timeout.tld)} {(user)}) ] spids: [228] ) spids: [224 227] ) (command.FuncDef name: reject body: (command.BraceGroup children: [ (command.Pipeline children: [ (command.Subshell child: (command.CommandList children: [ (C {(echo)} {(Lit_VarLike 'protocol=') ($ VSub_Number '$2')}) (C {(echo)} {(Lit_VarLike 'host=') ($ VSub_Number '$3')}) (C {(echo)} {(Lit_VarLike 'username=') ($ VSub_Number '$4')}) ] ) spids: [295 316] ) (C {(git)} {(-c)} {(credential.helper) (Lit_Other '=') ($ VSub_Number '$1')} {(credential)} {(reject)} ) ] negated: F ) ] spids: [292] ) spids: [288 291] ) (command.FuncDef name: helper_test body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:HELPER spids:[342]) op: Equal rhs: {($ VSub_Number '$1')} spids: [342] ) ] spids: [342] ) (C {(test_expect_success)} {(DQ ('helper (') ($ VSub_Name '$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.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <'https://example.com'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <':\n'> <'\t\taskpass: Password for '>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <'https://askpass-username@example.com'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) (C {(test_expect_success)} {(DQ ('helper (') ($ VSub_Name '$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 (') ($ VSub_Name '$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 (') ($ VSub_Name '$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.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <'http://example.com'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <':\n'> <'\t\taskpass: Password for '>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <'http://askpass-username@example.com'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) (C {(test_expect_success)} {(DQ ('helper (') ($ VSub_Name '$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.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <'https://other.tld'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <':\n'> <'\t\taskpass: Password for '>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <'https://askpass-username@other.tld'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) (C {(test_expect_success)} {(DQ ('helper (') ($ VSub_Name '$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.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <'https://other@example.com'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) (C {(test_expect_success)} {(DQ ('helper (') ($ VSub_Name '$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.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <'http://path.tld/bar.git'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <':\n'> <'\t\taskpass: Password for '>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <'http://askpass-username@path.tld/bar.git'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) (C {(test_expect_success)} {(DQ ('helper (') ($ VSub_Name '$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.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <'https://example.com'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <':\n'> <'\t\taskpass: Password for '>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <'https://askpass-username@example.com'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) (C {(test_expect_success)} {(DQ ('helper (') ($ VSub_Name '$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 (') ($ VSub_Name '$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.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <'https://user1@example.com'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) (C {(test_expect_success)} {(DQ ('helper (') ($ VSub_Name '$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'> ) } ) ] spids: [339] ) spids: [335 338] ) (command.FuncDef name: helper_test_timeout body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:HELPER spids:[777]) op: Equal rhs: {(DQ ($ VSub_Star '$*'))} spids: [777] ) ] spids: [777] ) (C {(test_expect_success)} {(DQ ('helper (') ($ VSub_Name '$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.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <'https://timeout.tld'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <':\n'> <'\t\taskpass: Password for '>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <'https://askpass-username@timeout.tld'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <':\n'> <'\t\tEOF\n'> <'\t'>) } ) ] spids: [774] ) spids: [770 773] ) (command.SimpleCommand words: [{(write_script)} {(askpass)}] redirects: [ (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)} here_end_span_id: 846 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') ] ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_ASKPASS spids:[847]) op: Equal rhs: {(DQ ($ VSub_Name '$PWD') (/askpass))} spids: [847] ) ] spids: [847] ) (C {(export)} {(GIT_ASKPASS)}) ] )