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

Re: [PATCH] git-remote-mediawiki: use git.pm functions for credentials

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 4, 2013, 18:44 UTC
Message-ID
<7vr4gh7m24.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1370344292-7088-1-git-send-email-benoit.person@ensimag.fr>
benoit.person@gmail.com writes:
Show 11 quoted lines
> From: Benoit Person <benoit.person@ensimag.fr>
>
> In 52dce6d, a new credential function was added to git.pm, based on
> git-remote-mediawiki's functions. The logical follow-up is to use
> those functions in git-remote-mediawiki.
>
> Signed-off-by: Benoit Person <benoit.person@ensimag.fr>
> Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
> ---
>  contrib/mw-to-git/git-remote-mediawiki.perl | 66 ++++-------------------------
>  1 file changed, 9 insertions(+), 57 deletions(-)
With s/git.pm/Git.pm/, the above looks perfect.
Show 20 quoted lines
> @@ -217,22 +167,24 @@ sub mw_connect_maybe {
>  	$mediawiki = MediaWiki::API->new;
>  	$mediawiki->{config}->{api_url} = "$url/api.php";
>  	if ($wiki_login) {
> -		my %credential = (url => $url);
> -		$credential{username} = $wiki_login;
> -		$credential{password} = $wiki_passwd;
> -		credential_run("fill", \%credential);
> +		my %credential = (
> +			'url' => $url,
> +			'username' => $wiki_login,
> +			'password' => $wiki_passwd
> +		);
> +		Git::credential \%credential;
>  		my $request = {lgname => $credential{username},
>  			       lgpassword => $credential{password},
>  			       lgdomain => $wiki_domain};
>  		if ($mediawiki->login($request)) {
> -			credential_run("approve", \%credential);
> +			Git::credential \%credential, 'approve';

The example in perl/Git.pm for =item credential shows the subroutine call without surrounding parentheses, and that is perfectly valid Perl, but given that the prevalent style of subroutine calls made in this file seems to be with them, i.e. subr(arg, arg), you might want to consider being consistent here (and in the implicit 'fill' call several lines above, and 'reject' call below).

Thanks.
Show 11 quoted lines
>  			print STDERR "Logged in mediawiki user \"$credential{username}\".\n";
>  		} else {
>  			print STDERR "Failed to log in mediawiki user \"$credential{username}\" on $url\n";
>  			print STDERR "  (error " .
>  				$mediawiki->{error}->{code} . ': ' .
>  				$mediawiki->{error}->{details} . ")\n";
> -			credential_run("reject", \%credential);
> +			Git::credential \%credential, 'reject';
>  			exit 1;
>  		}
>  	}
Previous: benoit.person@gmail.comNext: benoit.person@ensimag.fr
Message 2 of 4 in “git-remote-mediawiki: use git.pm functions for credentials”
  1. git-remote-mediawiki: use git.pm functions for credentialsbenoit.person@gmail.com, Jun 4, 2013
  2. Junio C HamanoJun 4, 2013
  3. git-remote-mediawiki: use Git.pm functions for credentialsbenoit.person@ensimag.fr, Jun 5, 2013
  4. Jeff KingJun 5, 2013

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.