git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v6 7/7] git: submodule honor -c credential.* from command line

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 1, 2016, 17:26 UTC
Message-ID
<xmqqh9gq85yc.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAGZ79kbDaV=i0augzh5RgGYpTWXOuTLx=7Occhc-6iE+0pBVNg@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
Show 23 quoted lines
> On Mon, Feb 29, 2016 at 2:58 PM, Jacob Keller <jacob.e.keller@intel.com> wrote:
>>
>> +test_expect_success 'cmdline credential config passes into submodules' '
>> +       git init super &&
>> +       set_askpass user@host pass@host &&
>
> I wonder why we use pass@host as a password, it seems confusing to me.
> p@ssword would have worked if we wanted to test a password containing an @,
> pass@host doesn't quite fit my mental model of how passwords work.
> No need to change anything, better be consistent with the rest of the tests.
>
>
>> +       (
>> +               cd super &&
>> +               git submodule add "$HTTPD_URL/auth/dumb/repo.git" sub &&
>> +               git commit -m "add submodule"
>> +       ) &&
>> +       set_askpass wrong pass@host &&
>> +       test_must_fail git clone --recursive super super-clone &&
>> +       rm -rf super-clone &&
>> +       set_askpass wrong pass@host &&
>
> Why set set_askpass a second time here?
I find this in t/lib-httpd.sh:
        set_askpass() {
                >"$TRASH_DIRECTORY/askpass-query" &&
                echo "$1" >"$TRASH_DIRECTORY/askpass-user" &&
                echo "$2" >"$TRASH_DIRECTORY/askpass-pass"
        }

and expect_askpass peeks at askpass-query to see if Git asked the right questions.

I think askpass-query is cleared here because the author of the test suite expected that the helpers are used in such a way that you always (1) set-askpass once, (2) run a Git command that asks credentials, (3) use expect_askpass to validate and do these three steps as a logical unit?

That "clone" the test expects to fail does ask the credential, so even though the test does not check if the "clone" asked the right question, it finishes the three-step logical unit, and then you need to clear askpass-query.

It may have been cleaner if you had clear_askpass_query helper that is called (1) at the beginning of set_askpass instead of this manual clearing, (2) at the end of expect_askpass, as the exchange has been tested already at that point, and (3) in place of expect_askpass if you choose not to call it (e.g. this place, instead of the second set_askpass, you would say clear_askpass_query), perhaps, but I do know if that is worth it.

Previous: Jeff KingNext: Jacob Keller
Message 17 of 27 in “submodule--helper credential.* pass into submodule”
  1. 0/7 submodule--helper credential.* pass into submoduleJacob Keller, Feb 29, 2016
  2. 1/7 t/lib-httpd: load mod_unixdJacob Keller, Feb 29, 2016
  3. 2/7 submodule: don't pass empty string arguments to submodule--helper cloneJacob Keller, Feb 29, 2016
  4. Stefan BellerFeb 29, 2016
  5. 3/7 submodule: check argc count for git submodule--helper cloneJacob Keller, Feb 29, 2016
  6. Stefan BellerFeb 29, 2016
  7. 4/7 submodule: fix submodule--helper clone usageJacob Keller, Feb 29, 2016
  8. Stefan BellerFeb 29, 2016
  9. 5/7 submodule: fix segmentation fault in submodule--helper cloneJacob Keller, Feb 29, 2016
  10. Stefan BellerFeb 29, 2016
  11. Jacob KellerFeb 29, 2016
  12. 6/7 quote: implement sq_quotef()Jacob Keller, Feb 29, 2016
  13. 7/7 git: submodule honor -c credential.* from command lineJacob Keller, Feb 29, 2016
  14. Stefan BellerFeb 29, 2016
  15. Jacob KellerFeb 29, 2016
  16. Jeff KingMar 1, 2016
  17. Junio C HamanoMar 1, 2016
  18. Jacob KellerMar 1, 2016
  19. Junio C HamanoMar 1, 2016
  20. Jacob KellerMar 1, 2016
  21. Jonathan NiederMar 22, 2016
  22. Jeff KingMar 22, 2016
  23. git_config_push_parameter: handle empty GIT_CONFIG_PARAMETERSJeff King, Mar 22, 2016
  24. Junio C HamanoMar 22, 2016
  25. Jonathan NiederMar 22, 2016
  26. Jacob KellerMar 23, 2016
  27. Junio C HamanoMar 23, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.