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

Re: [PATCH v2] add git credential login to remote mediawiki

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Jun 11, 2012, 19:13 UTC
Message-ID
<vpqaa094q6q.fsf@bauges.imag.fr>
In-Reply-To
<1339440893-8522-1-git-send-email-Javier.Roucher-Iglesias@enismag.imag.fr>
Javier.Roucher-Iglesias@ensimag.imag.fr writes:
Show 6 quoted lines
> --- a/contrib/mw-to-git/git-remote-mediawiki
> +++ b/contrib/mw-to-git/git-remote-mediawiki
> @@ -154,26 +154,107 @@ while (<STDIN>) {
>  # MediaWiki API instance, created lazily.
>  my $mediawiki;
>  
[...]
> +my $mediawiki;
You're adding a second declaration of $mediawiki. Cut-and-paste issue?

Plus, didn't I already mention that this "my $mediawiki;" was meant to be right above mw_connect_maybe?

> +        if ($wiki_login ne "") {
> +                $msg .= "username=$wiki_login\n";
> +        }
Indentation with space.
Show 6 quoted lines
> +	my $key;
> +	my $value;
> +	my $Prog = "git credential $op";
> +	open2(*Reader, *Writer, $Prog);
> +	print Writer $msg;
> +	close (Writer);
No space before "(" (already mentionned off-list).
> +			# error if key undef
> +			if (not defined $key) {
The comment is useless and therefore counter-productive. Remove it.
> +				print STDERR "ERROR reciving reponse git credential fill\n";

You can add $_ to the message. If this ever happens, the user will appreciate to see what's going on.

>  sub mw_connect_maybe {
> +
>  	if ($mediawiki) {
Don't add useless newlines.
Show 8 quoted lines
> +		if (!$wiki_passwd) {
> +			#user knows, password not.
> +			ask_login();
>  		} else {
> -			print STDERR "Logged in with user \"$wiki_login\".\n";
> +			#user and password knows.
> +			ask_login();
>  		}
What is this? You have an "if" with both branches identical.

If the user didn't specify any login name, then you should try to connect to the wiki anonymously, which works in many wikis.

(BTW, doesn't "ask_login" ask for a password more than a login? If so, please rename the function).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: javier.roucher-iglesias@ensimag.imag.frNext: Simon Perrat
Message 2 of 4 in “add git credential login to remote mediawiki”
  1. add git credential login to remote mediawikijavier.roucher-iglesias@ensimag.imag.fr, Jun 11, 2012
  2. Matthieu MoyJun 11, 2012
  3. Simon PerratJun 12, 2012
  4. roucherjJun 12, 2012

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.