git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Kevin <kevin@ki-ai.org>
To: "Eric Sunshine" <sunshine@sunshineco.com>,
	"Antoine Beaupré" <anarcat@debian.org>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH 1/4] remote-mediawiki: add namespace support
Date: Sun, 29 Oct 2017 23:08:00 +0000	[thread overview]
Message-ID: <6ed0d8d4-243a-7afc-bd37-a6f71004e195@ki-ai.org> (raw)
In-Reply-To: <CAPig+cTySXEWGxSUTxQXmHz7rR_nTbf+ALciZahJ2Ks6EmSqzg@mail.gmail.com>

So I shared the patch some time ago (~2 years). Surprisingly its just
now getting attention. I guess some renewed interest in using mediawiki
with git. Myself, however, am no longer using mediawiki. Nor am I
completely clear on what the reasons were for using some variable or
another a couple of years ago. So... the best of luck, sorry I couldn't
be more helpful.

Eric Sunshine:
> On Sun, Oct 29, 2017 at 2:29 PM, Antoine Beaupré <anarcat@debian.org> wrote:
>> On 2017-10-29 13:24:03, Eric Sunshine wrote:
>>> On Sun, Oct 29, 2017 at 12:08 PM, Antoine Beaupré <anarcat@debian.org> wrote:
>>> So, the idea is that if the input has form "something:number", then
>>> you want to look up "something" as a namespace name. Anything else
>>> (such as "something:foobar") is not considered a valid page reference.
>>> Right?
>>
>> frankly, i have no idea what's going on here.
>>
>>> The multiple 'return's are a bit messy. Perhaps collapse the entire
>>> function to something like this:
>>>
>>>     sub get_mw_namespace_id_for_page {
>>>         my $arg = shift;
>>>         if ($arg =~ /^([^:]+):\d+$/) {
>>>             return get_mw_namespace_id($1);
>>>         }
>>>         return undef;
>>>     }
>>>
>>> In fact, it may be that the intent of the original code *was* meant to
>>> do exactly the same as shown in my example above, but that the person
>>> who wrote it accidentally typed:
>>>
>>>     return get_mw_namespace_id($namespace);
>>>
>>> instead of the intended:
>>>
>>>     return get_mw_namespace_id($1);
>>>
>>> So, a minimal fix would be simply to change $namespace to $1.
>>> Tightening the regex as I did in my example would be a bonus (though
>>> probably ought to be a separate patch).
>>
>> so while i'm happy to just copy-paste your code in there, that's kind of
>> a sensitive area of the code, as it was originally used only in the
>> upload procedure, which I haven't tested at all. so i'm hesitant in just
>> merging that in as is.
> 
> I don't think there's a need to copy/paste my example code. If you
> instead make the minimal suggested fix, then the resulting code will
> be effectively equivalent to my example (minus the tighter regex).
> 
>> i don't understand why or how this even works, to be honest: page names
>> don't necessarily look like numbers, in fact, they generally don't. i
>> don't understand why the patch submitted here even touches that function
>> at all, considering that the function is only used on uploads. I just
>> cargo-culted it from the original issue...
> 
> I, myself, am not familiar with or a user of Mediawiki or with the Git
> bridging, and I don't know what page names look like, but I'm pretty
> well convinced from reading both the existing code and this patch that
> the changes to get_mw_namespace_id_for_page() are really just a bug
> fix to that function. My interpretation is that the function really
> was intended to strip the ":id" portion of "name:id" before calling
> get_mw_namespace_id(); the fact that the original code neglects to do
> so seems just an oversight. The fact that the regex uses capturing
> parentheses implies strongly that it was indeed the intention to use
> $1 in the call to get_mw_namespace_id(). Unlike the "fix" in the patch
> you posted from Kevin, which is perhaps unnecessarily complicated, the
> fix I suggested above is about a minimal as possible. That is,
> changing:
> 
>      return get_mw_namespace_id($namespace);
> 
> to:
> 
>      return get_mw_namespace_id($1);
> 
> should achieve the same result. (It could be made more robust by
> tightening the regex as in my example, but that's a separate topic,
> not needed just to get the function to work as intended.)
> 


  reply	other threads:[~2017-10-29 23:14 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-29 16:08 [PATCH 0/4] WIP: git-remote-media wiki namespace support Antoine Beaupré
2017-10-29 16:08 ` [PATCH 1/4] remote-mediawiki: add " Antoine Beaupré
2017-10-29 17:24   ` Eric Sunshine
2017-10-29 18:29     ` Antoine Beaupré
2017-10-29 20:07       ` Eric Sunshine
2017-10-29 23:08         ` Kevin [this message]
2017-10-30  2:14           ` Antoine Beaupré
2017-10-30  2:51   ` [PATCH v2 0/7] " Antoine Beaupré
2017-10-30  2:51     ` [PATCH 1/7] " Antoine Beaupré
2017-10-30  2:51     ` [PATCH 2/7] remote-mediawiki: allow fetching namespaces with spaces Antoine Beaupré
2017-10-30  2:51     ` [PATCH 3/7] remote-mediawiki: show known namespace choices on failure Antoine Beaupré
2017-10-30  2:51     ` [PATCH 4/7] remote-mediawiki: skip virtual namespaces Antoine Beaupré
2017-11-01 13:52       ` Eric Sunshine
2017-11-01 16:45         ` Antoine Beaupré
2017-11-02  1:24           ` Junio C Hamano
2017-11-02 21:20             ` Antoine Beaupré
2017-11-06  0:38               ` Junio C Hamano
2017-10-30  2:51     ` [PATCH 5/7] remote-mediawiki: support fetching from (Main) namespace Antoine Beaupré
2017-11-01 19:56       ` Eric Sunshine
2017-11-02 21:19         ` Antoine Beaupré
2017-10-30  2:51     ` [PATCH 6/7] remote-mediawiki: process namespaces in order Antoine Beaupré
2017-11-01 19:59       ` Eric Sunshine
2017-10-30  2:51     ` [PATCH 7/7] remote-mediawiki: show progress while fetching namespaces Antoine Beaupré
2017-11-01 20:01       ` Eric Sunshine
2017-11-02 21:25     ` [PATCH v3 0/7] remote-mediawiki: namespace support Antoine Beaupré
2017-11-02 21:25       ` [PATCH v3 1/7] remote-mediawiki: add " Antoine Beaupré
2017-11-02 21:25       ` [PATCH v3 2/7] remote-mediawiki: allow fetching namespaces with spaces Antoine Beaupré
2017-11-02 21:25       ` [PATCH v3 3/7] remote-mediawiki: show known namespace choices on failure Antoine Beaupré
2017-11-02 21:25       ` [PATCH v3 4/7] remote-mediawiki: skip virtual namespaces Antoine Beaupré
2017-11-02 22:43         ` Eric Sunshine
2017-11-02 22:54           ` Antoine Beaupré
2017-11-02 21:25       ` [PATCH v3 5/7] remote-mediawiki: support fetching from (Main) namespace Antoine Beaupré
2017-11-02 22:48         ` Eric Sunshine
2017-11-02 21:25       ` [PATCH v3 6/7] remote-mediawiki: process namespaces in order Antoine Beaupré
2017-11-02 22:49         ` Eric Sunshine
2017-11-02 21:25       ` [PATCH v3 7/7] remote-mediawiki: show progress while fetching namespaces Antoine Beaupré
2017-11-02 22:18         ` Thomas Adam
2017-11-02 22:26           ` Antoine Beaupré
2017-11-02 22:31             ` Thomas Adam
2017-11-02 23:10               ` Antoine Beaupré
2017-11-04  9:57                 ` Thomas Adam
2017-11-02 22:50         ` Eric Sunshine
2017-11-06 21:19       ` [PATCH v4 0/7] remote-mediawiki: namespace support Antoine Beaupré
2017-11-06 21:19         ` [PATCH v4 1/7] remote-mediawiki: add " Antoine Beaupré
2017-11-06 21:19         ` [PATCH v4 2/7] remote-mediawiki: allow fetching namespaces with spaces Antoine Beaupré
2017-11-07  7:08           ` Thomas Adam
2017-11-07 16:03             ` Antoine Beaupré
2017-11-06 21:19         ` [PATCH v4 3/7] remote-mediawiki: show known namespace choices on failure Antoine Beaupré
2017-11-07 10:45           ` Thomas Adam
2017-11-07 16:07             ` Antoine Beaupré
2017-11-06 21:19         ` [PATCH v4 4/7] remote-mediawiki: skip virtual namespaces Antoine Beaupré
2017-11-06 21:19         ` [PATCH v4 5/7] remote-mediawiki: support fetching from (Main) namespace Antoine Beaupré
2017-11-06 21:19         ` [PATCH v4 6/7] remote-mediawiki: process namespaces in order Antoine Beaupré
2017-11-06 21:19         ` [PATCH v4 7/7] remote-mediawiki: show progress while fetching namespaces Antoine Beaupré
2017-11-07 16:06       ` [PATCH v5 0/7] namespace support Antoine Beaupré
2017-11-07 16:06         ` [PATCH v5 1/7] remote-mediawiki: add " Antoine Beaupré
2017-11-07 16:06         ` [PATCH v5 2/7] remote-mediawiki: allow fetching namespaces with spaces Antoine Beaupré
2017-11-07 16:06         ` [PATCH v5 3/7] remote-mediawiki: show known namespace choices on failure Antoine Beaupré
2017-11-07 16:06         ` [PATCH v5 4/7] remote-mediawiki: skip virtual namespaces Antoine Beaupré
2017-11-07 16:06         ` [PATCH v5 5/7] remote-mediawiki: support fetching from (Main) namespace Antoine Beaupré
2017-11-07 16:07         ` [PATCH v5 6/7] remote-mediawiki: process namespaces in order Antoine Beaupré
2017-11-07 16:07         ` [PATCH v5 7/7] remote-mediawiki: show progress while fetching namespaces Antoine Beaupré
2017-11-08  2:07         ` [PATCH v5 0/7] namespace support Junio C Hamano
2017-10-30 10:43   ` [PATCH 1/4] remote-mediawiki: add " Matthieu Moy
2017-10-29 16:08 ` [PATCH 2/4] remote-mediawiki: allow fetching namespaces with spaces Antoine Beaupré
2017-10-29 16:08 ` [PATCH 3/4] remote-mediawiki: show known namespace choices on failure Antoine Beaupré
2017-10-29 17:34   ` Eric Sunshine
2017-10-29 18:31     ` Antoine Beaupré
2017-11-04 10:57   ` Thomas Adam
2017-10-29 16:08 ` [PATCH 4/4] remote-mediawiki: allow using (Main) as a namespace and skip special namespaces Antoine Beaupré
2017-10-29 19:49   ` Eric Sunshine
2017-10-30  2:11     ` Antoine Beaupré
2017-10-30  3:49       ` Eric Sunshine
2017-10-30  2:43     ` Antoine Beaupré
2017-10-30  3:52       ` Eric Sunshine
2017-10-30 12:17         ` Antoine Beaupré
2017-10-30 10:40 ` [PATCH 0/4] WIP: git-remote-media wiki namespace support Matthieu Moy
2017-10-30 12:20   ` Antoine Beaupré

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=6ed0d8d4-243a-7afc-bd37-a6f71004e195@ki-ai.org \
    --to=kevin@ki-ai.org \
    --cc=anarcat@debian.org \
    --cc=git@vger.kernel.org \
    --cc=sunshine@sunshineco.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).