diff options
| author | Michael Forney <mforney@mforney.org> | 2022-09-09 13:49:46 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2022-09-09 13:49:46 -0700 |
| commit | f678b5d3e61eb77f71ccdfdd64ffe3f154cb56ea (patch) | |
| tree | caf29237b4728b54b42bb2d89d92c259e2347fc6 /pkg/git/patch/0001-request-pull-use-awk-instead-of-perl-to-parse-ls-rem.patch | |
| parent | 63490ce27818d1b7985d851fb1ee19eaa4d71f37 (diff) | |
git: Update to 2.37.3
Diffstat (limited to 'pkg/git/patch/0001-request-pull-use-awk-instead-of-perl-to-parse-ls-rem.patch')
| -rw-r--r-- | pkg/git/patch/0001-request-pull-use-awk-instead-of-perl-to-parse-ls-rem.patch | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/pkg/git/patch/0001-request-pull-use-awk-instead-of-perl-to-parse-ls-rem.patch b/pkg/git/patch/0001-request-pull-use-awk-instead-of-perl-to-parse-ls-rem.patch new file mode 100644 index 00000000..1ad01d3c --- /dev/null +++ b/pkg/git/patch/0001-request-pull-use-awk-instead-of-perl-to-parse-ls-rem.patch @@ -0,0 +1,84 @@ +From 1b87b640fac0fa52de5da8d2c57d038cc0cef5b1 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.34.0 + |
