logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: c77f540dd137d459712d1e931dd4188426996f73
parent 49613aa25795787de644669bcdea81295befbc36
Author: Michael Forney <mforney@mforney.org>
Date:   Sun, 18 Apr 2021 23:53:02 -0700

git: Use awk instead of perl for request-pull

Diffstat:

Apkg/git/patch/0002-request-pull-use-awk-instead-of-perl-to-parse-ls-rem.patch84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mpkg/git/ver2+-
2 files changed, 85 insertions(+), 1 deletion(-)

diff --git a/pkg/git/patch/0002-request-pull-use-awk-instead-of-perl-to-parse-ls-rem.patch b/pkg/git/patch/0002-request-pull-use-awk-instead-of-perl-to-parse-ls-rem.patch @@ -0,0 +1,84 @@ +From 7cb4481678c7cffd129b85e39c5a080055587372 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Tue, 16 Mar 2021 17:21:31 -0700 +Subject: [PATCH] request-pull: use awk instead of perl to parse ls-remote + output + +--- + git-request-pull.sh | 48 +++++++++++++++++++++++++++------------------ + 1 file changed, 29 insertions(+), 19 deletions(-) + +diff --git a/git-request-pull.sh b/git-request-pull.sh +index 2d0e44656c..0e3cf644e0 100755 +--- a/git-request-pull.sh ++++ b/git-request-pull.sh +@@ -82,37 +82,47 @@ die "fatal: No commits in common between $base and $head" + # Find a ref with the same name as $head that exists at the remote + # and points to the same commit as the local object. + find_matching_ref=' +- my ($head,$headrev) = (@ARGV); +- my $pattern = qr{/\Q$head\E$}; +- my ($remote_sha1, $found); ++ function endswith(s, t) { ++ n = length(s) ++ m = length(t) ++ return m <= n && substr(s, n - m + 1) == t ++ } + +- while (<STDIN>) { +- chomp; +- my ($sha1, $ref, $deref) = /^(\S+)\s+([^^]+)(\S*)$/; ++ { ++ sha1 = $1 ++ ref = $2 + +- if ($sha1 eq $head) { +- $found = $remote_sha1 = $sha1; +- break; ++ if (sha1 == head) { ++ found = remote_sha1 = sha1 ++ exit + } + +- if ($ref eq $head || $ref =~ $pattern) { +- if ($deref eq "") { ++ deref = index(ref, "^") ++ if (deref) ++ ref = substr(ref, 1, deref - 1) ++ ++ if (ref == head || endswith(ref, "/" head)) { ++ if (!deref) { + # Remember the matching object on the remote side +- $remote_sha1 = $sha1; ++ remote_sha1 = sha1 + } +- if ($sha1 eq $headrev) { +- $found = $ref; +- break; ++ if (sha1 == headrev) { ++ found = ref ++ exit + } + } + } +- if ($found) { +- $remote_sha1 = $headrev if ! defined $remote_sha1; +- print "$remote_sha1 $found\n"; ++ ++ END { ++ if (found) { ++ if (!remote_sha1) ++ remote_sha1 = headrev ++ print remote_sha1 " " found ++ } + } + ' + +-set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev") ++set fnord $(git ls-remote "$url" | awk -v "head=${remote:-HEAD}" -v "headrev=$headrev" "$find_matching_ref") + remote_sha1=$2 + ref=$3 + +-- +2.30.1 + diff --git a/pkg/git/ver b/pkg/git/ver @@ -1 +1 @@ -2.31.1 r0 +2.31.1 r1