git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 0/2] StGit patch series import
Date: Sun, 24 May 2009 23:43:40 +0200	[thread overview]
Message-ID: <cb7bb73a0905241443m6b5d6ba4vab438c856e47a947@mail.gmail.com> (raw)
In-Reply-To: <7voctirzu6.fsf@alter.siamese.dyndns.org>

On Sun, May 24, 2009 at 10:49 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
>
>> This small patch series implements support for Stacked Git patch
>> series import.
>>
>> The first commit adds support for StGit patches to mailinfo, which is
>> required because StGit's default export template puts the From: line
>> between the subject and the body.
>
> This problem description makes it sound as if we always expect From: to
> come before Subject: in the mailbox, and reject the input if they come in
> a different order, which would be a bug.  Fixing it would not be limited
> to supporting StGIT generated patch email.

I should probably have added the information that the subject in StGIT
patches is _not_ prefixed by 'Subject: ', it's just placed as-is. So
it's not a matter of ordering.

> But a quick glance at the actual patch makes me suspect that is not what
> you are doing.  You are feeding something that is not a mailbox at all to
> the mailinfo and _unconditionally_ extract the information according to
> StGIT rules.
>
> That's a bad taste.
>
> At least, add a "this is not a mailbox, but is a StGIT formatted file, so
> please extract info according to the StGIT rule, not the mailbox rule"
> option, and
>
>  (1) have a parameter to mailinfo() to trigger your new codepath only
>      when the option is given; or

[snip]

> so that normal mailinfo invocation does not mishandle input that is _not_
> StGIT output.

When I started coding this feature, I had some thoughts about this,
and my initial choice was to implement it following the suggestions
you mentioned. However, after thinking about it a while I realized the
following: the new code-path is taken only if the file does not start
with (what looks like) a mail header. If the file is not a StGIT patch
exported with the default template, the info extraction will fail
somewhere else (e.g. because no author or no diff is found).

So in the end I decided to go the much simpler way of the patches I sent.

>> The second commit makes git-am autodetect an StGit patch series index
>> (when it's the only file passed to it) and proceeds to import the
>> patches indicated in the series.
>
> And that change would be a good place to decide to pass that "This is not
> a mailbox but is a StGIT output" option to the updated mailinfo program
> (or the new "stgitinfo" program).

That was my initial thought too, but then I realized that having the
'heuristics' (although a very braindead one) in mailinfo makes more
sense because otherwise StGIT patch autodetection would only work when
applying a whole series, and not when applying a single (or a few)
patches.

> What is the larger picture workflow that this new feature is expected to
> help?  A project takes patches not in e-mail form but in a directory full
> of files uploaded via scp/sftp with the StGIT series file and individual
> StGIT patches that are pointed by the series file contained within?

Sort of.  The specifics is that there's a guy developing a DIB engine
for Wine and he's using StGIT to handle the patches on top of the
official Wine git tree. Periodically he zips the patch series
(index+patches) and attaches it to the relevant bugzilla entry.

> I do not use StGIT anymore, so I do not remember how flexible its export
> template mechanism is, nor how widely people use non-default templates,
> but I have wonder about two and half things.
>
>  - I am assuming that your patch won't be able to read the StGIT output if
>   the uploader used non-default export template, so such a project needs
>   to ask the uploaders to use the default template.

Well, in the use-case that triggered my need for the StGIT import,
that was the case already.

>   If that is the case, why not ask them to use a custom template that
>   generates one single valid mailbox that stores the patches in the right
>   order?  That can be processed with stock "git am"; in addition, the
>   output can be fed not just to "git".  Any other SCM that can work with
>   e-mail based patchflow can use it.

We have actually asked him to use plain git instead of StGIT, but he's
more comfortable with the latter. We could ask him to fix the header,
yes. I'm not too optimistic about a positive response.

>  - Such a project can allow users to use random export templates as long
>   as the template used to export the series is indentifiable (perhaps by
>   including that template itself in the upload).  Your mailinfo patch
>   needs to be extended to reverse what the export template did, and it
>   really shouldn't be in the normal mailinfo() codepath.  The right
>   approach would become something like (3) above, i.e. separate
>   "StGITinfo" program called from "git am" if that is what you shoot for.

Oh, in my grand plan of things git am should be able to handle all
kind of foreign patches (svn and the patches sent by Bram Moolenar
uses for vim being top candidates). (Of course it would be appropriate
to rename it to something else then.) Sadly, I quickly discovered that
my file and string manipulation-fu in C is not really what I would
call 'strong'.

(And since I needed it fast, I went the easy rather than the formally
correct way.)

>  - If StGIT is used by the project to such an extent to allow series
>   directory upload, shouldn't the receiving end be also using StGIT to
>   import the series, instead of running "git am" anyway?

As I mentioned, Wine uses plain git, and we've tried asking this
(non-core) developer to expose a standard git tree. But he finds StGIT
much more comfortable for the task.

-- 
Giuseppe "Oblomov" Bilotta

  reply	other threads:[~2009-05-24 21:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-24  7:19 [PATCH 0/2] StGit patch series import Giuseppe Bilotta
2009-05-24 20:49 ` Junio C Hamano
2009-05-24 21:43   ` Giuseppe Bilotta [this message]
2009-05-24 21:55     ` Sverre Rabbelier
2009-05-24 22:04       ` Giuseppe Bilotta
2009-05-24 22:05         ` Sverre Rabbelier
2009-05-24 22:02     ` Junio C Hamano
2009-05-24 22:18       ` Giuseppe Bilotta
2009-05-24 22:28         ` Sverre Rabbelier
2009-05-24 22:53           ` Giuseppe Bilotta
2009-05-24 22:57             ` Sverre Rabbelier
2009-05-24 23:03               ` Giuseppe Bilotta
2009-05-25  6:39                 ` Junio C Hamano
2009-05-25  7:19                   ` Giuseppe Bilotta

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=cb7bb73a0905241443m6b5d6ba4vab438c856e47a947@mail.gmail.com \
    --to=giuseppe.bilotta@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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 NNTP newsgroup(s).