git-request-get ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am still haunted by my own ancient comment on
https://gitlab.com/gitlab-org/gitlab/-/issues/14116:

> Well, the minimal solution [to federated merge requests]
> would be a parser for the git-request-pull(1), which would
> check every comment and if recognized the comment as the
> pull request, it would add button for the owner of the repo
> (e.g., [Create Pull Request]). After pressing that (so it is
> constantly under the control of the owner repo), gitlab would
> setup new remote (if doesn't exist still), fetch it, and create
> a merge request.

Of course, the part with a button has to be resolved in a
particular web application, but I am still wondering whether
there isn’t any way how to make consuming git-request-pull(1)
generated emails more easily digestable and thus promote the use
of the tool.

First I created rather complicated bash script
(https://da.gd/pSgdc), but then I have read CodingGuidelines and
found that I need to keep myself to the POSIX shell script, so
I have simplified a lot. Besides, I don’t think the complicated
part (like adding remotes) is necessarily a good thing (???).
Currently I have just this:

    #!/bin/sh
    set -eu

    STR="$(cat)"

    URL="$(echo "$STR" | sed -n -e '/^are available in the Git repository at:/,+2 {
    s/[[:space:]]\+//
    s/\(=[[:digit:]]\{2\}\)\+$//
    /^\(http\|git\)/p
    }')"

    END="$(echo "$STR" | awk '/^for you to fetch changes up to / { print $NF }' | sed -e 's/[=:]*$//')"
    git fetch "$URL" "$END"
    git checkout -B _4review FETCH_HEAD

Do you think this is a good idea at all? Should we be more
complicated or less? Should we do some fun things like parsing
and adding remotes, parsing email addresses or something to
create individualized branch names for review? Stuff like that.

Looking forward to any feedback.

Best,

Matěj

-- 
http://matej.ceplovi.cz/blog/, @mcepl@floss.social
GPG Finger: 3C76 A027 CA45 AD70 98B5  BC1D 7920 5802 880B C9D8
 
Those to whom evil is done \ Do evil in return.
    -- W. H. Auden, September 1, 1939
       http://www.poets.org/viewmedia.php/prmMID/15545

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux