All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: benoit.person@gmail.com
Cc: git@vger.kernel.org, celestin.matte@ensimag.fr,
	Benoit Person <benoit.person@ensimag.fr>,
	Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Subject: Re: [PATCH] git-remote-mediawiki: use git.pm functions for credentials
Date: Tue, 04 Jun 2013 11:44:35 -0700	[thread overview]
Message-ID: <7vr4gh7m24.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1370344292-7088-1-git-send-email-benoit.person@ensimag.fr> (benoit person's message of "Tue, 4 Jun 2013 13:11:32 +0200")

benoit.person@gmail.com writes:

> 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.

> @@ -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.

>  			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;
>  		}
>  	}

  reply	other threads:[~2013-06-04 18:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-04 11:11 [PATCH] git-remote-mediawiki: use git.pm functions for credentials benoit.person
2013-06-04 18:44 ` Junio C Hamano [this message]
2013-06-05 10:58   ` [PATCH] git-remote-mediawiki: use Git.pm " benoit.person
2013-06-05 15:55     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vr4gh7m24.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=benoit.person@ensimag.fr \
    --cc=benoit.person@gmail.com \
    --cc=celestin.matte@ensimag.fr \
    --cc=git@vger.kernel.org \
    --cc=matthieu.moy@grenoble-inp.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.