zsh-workers
 help / color / mirror / code / Atom feed
From: Frank Terbeck <ft@bewatermyfriend.org>
To: "Johan Sundström" <oyasumi@gmail.com>
Cc: Nikolai Weibull <now@bitwi.se>,  Zsh Workers <zsh-workers@zsh.org>
Subject: Submitting patches [was: Re: Updated _git completion (not attached)]
Date: Sun, 20 Mar 2011 09:05:06 +0100	[thread overview]
Message-ID: <8762rekyj1.fsf@ft.bewatermyfriend.org> (raw)
In-Reply-To: <AANLkTikORnKwpv7sysJk4Mo4uzEXhf4a939D9jBhJ1JH@mail.gmail.com> ("Johan =?utf-8?Q?Sundstr=C3=B6m=22's?= message of "Sat, 19 Mar 2011 19:24:20 -0700")

Johan Sundström wrote:
> On Fri, Mar 18, 2011 at 14:18, Frank Terbeck <ft@bewatermyfriend.org> wrote:
>> [Etc/zsh-development-guide]
>
> This document doesn't mention it yet, but I assume it's best to submit
> patches in the message body rather than as attachments? (Unless, I suppose,
> they contain binary content.)

I think this is true (simply because it makes commenting patches
easier). But my answer on the matter is certainly not authoritative. I
thought I had seen similar comments on the list before; but I couldn't
find any in a quick search via
<http://www.zsh.org/cgi-bin/mla/wilma/workers>.

>> That being said, the output of "git format-patch" is usable,
>> too. Exchanging git's default "[PATCH]" by "PATCH: " would be extra
>> sugar.
>
> Running perl -pi -e 's/^(Subject: ).(PATCH[^]]*)./$1$2:/' *.patch on
> format-patch files fixes that (it seems command line options to git can't).
> Maybe a useful note for the dev guide?

The archive reacts to anything that starts with "PATCH". You can see the
results on <http://www.zsh.org/mla/patches.shtml>. So, your Perl snippet
would work. Even for numbered patches. The only thing I could think of
this could break is if there's a second line in the file that matches
your regular expression. Here is a zsh function which is using ed(1)
instead of Perl to achieve something similar. This is pretty much what
I've been using in the past.


function gsfix() {
    # zsh-workers prefers PATCH: as its prefix.
    #   fixes [PATCH] to PATCH:
    #     and [PATCH m/n] to PATCH: (m/n)

    if (( ${#argv} == 0 )); then
        printf 'Usage: gsfix <FILE(s)>\n'
        return 1
    fi

    local file
    for file in "$@"; do
        if [[ ! -w "${file}" ]]; then
            printf 'Cannot write to file: %s. Skipping.\n' "${file}"
            continue
        fi
        (
            printf '/^Subject: \[\n'
            printf 's,\[PATCH \([0-9]\+/[0-9]\+\)\],PATCH: (\\1),\n'
            printf 'w\nq\n'
        ) | ed "${file}" > /dev/null 2>&1

        [ "$?" -eq 0 ] && continue

        (
            printf '/^Subject: \[\n'
            printf 's,\[PATCH\],PATCH:,\n'
            printf 'w\nq\n'
        ) | ed "${file}" > /dev/null 2>&1
    done

    return 0
}

I don't know if we should put either into the development guide as a
note, since git isn't zsh's official VCS. And if it were, we could
probably change the patch archive code to handle git's "[PATCH] "
prefix.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925


  reply	other threads:[~2011-03-20  8:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 20:34 Updated _git completion (not attached) Nikolai Weibull
2011-02-19 13:39 ` Simon Ruderich
2011-02-21 14:34   ` Simon Ruderich
2011-02-27  3:45 ` Wayne Davison
2011-02-27  7:47   ` Frank Terbeck
2011-02-27 12:03     ` Nikolai Weibull
2011-02-27 12:25       ` Nikolai Weibull
2011-02-28 13:58         ` Simon Ruderich
2011-02-28 16:33           ` Wayne Davison
2011-02-28 17:07             ` Nikolai Weibull
2011-02-28 17:21               ` Mikael Magnusson
2011-02-28 20:32               ` Simon Ruderich
2011-02-28 20:58         ` Frank Terbeck
2011-03-04 12:57         ` Frank Terbeck
2011-03-18 20:34           ` Nikolai Weibull
2011-03-18 20:43             ` Frank Terbeck
2011-03-18 21:09               ` Nikolai Weibull
2011-03-18 21:18                 ` Frank Terbeck
2011-03-20  2:24                   ` Johan Sundström
2011-03-20  8:05                     ` Frank Terbeck [this message]
2011-03-20  8:47                       ` Submitting patches [was: Re: Updated _git completion (not attached)] Bart Schaefer
2011-03-20 15:41                         ` Benjamin R. Haskell
2011-03-20 17:50                           ` Bart Schaefer
2011-03-20 15:34                       ` Benjamin R. Haskell

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=8762rekyj1.fsf@ft.bewatermyfriend.org \
    --to=ft@bewatermyfriend.org \
    --cc=now@bitwi.se \
    --cc=oyasumi@gmail.com \
    --cc=zsh-workers@zsh.org \
    /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://git.vuxu.org/mirror/zsh/

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