You are not logged in.

#1 2021-06-20 13:02:46

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,273
Website

How to cherry pick a PR in a git PKGBUILD using git pull [SOLVED]

I want to cherry pick a pending PR in a git PKGBUILD.  I believe one way to do it is to use the following in the prepare function:

git pull --no-rebase origin pull/19892/head

I am building with makechrootpkg and this throws an error relating to an unknown committer.  What is the recommended way to fix?

...
From /startdir/xbmc
 * branch                    refs/pull/19892/head -> FETCH_HEAD
Committer identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'builduser@sky.(none)')
==> ERROR: A failure occurred in prepare().
    Aborting...

I could add this before the pull command, but perhaps there is a better way?

git config user.email "someone@somewhere.net"

Last edited by graysky (2021-06-20 13:40:07)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2021-06-20 13:24:14

progandy
Member
Registered: 2012-05-17
Posts: 4,447

Re: How to cherry pick a PR in a git PKGBUILD using git pull [SOLVED]

I have no better idea, but if you want you could extract the mail from the PACKAGER variable if it is set. (I do not see any practical use for that, though)
Edit: Or just set the env variable EMAIL or GIT_COMMITTER_EMAIL I think.

Last edited by progandy (2021-06-20 13:28:28)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#3 2021-06-20 13:36:34

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,273
Website

Re: How to cherry pick a PR in a git PKGBUILD using git pull [SOLVED]

I like the env variable suggestion.  Neither of those two work however... according to https://git-scm.com/book/en/v2/Git-Inte … -Variables they should.

EDIT: my bad... this works, thanks!

EMAIL="someone@somewhere.net" git pull --no-rebase origin pull/19892/head

Last edited by graysky (2021-06-20 13:38:26)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2021-06-20 16:25:10

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 4,097

Re: How to cherry pick a PR in a git PKGBUILD using git pull [SOLVED]

You should probably not be committing the results in prepare() as that changes the reported version from pkgver().

An alternative is git cherry-pick -n / --no-commit


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2021-06-20 16:43:48

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,273
Website

Re: How to cherry pick a PR in a git PKGBUILD using git pull [SOLVED]

eschwartz wrote:

You should probably not be committing the results in prepare() as that changes the reported version from pkgver().

An alternative is git cherry-pick -n / --no-commit

What is the syntax for cherry-pick when the target isn't a commit but is a PR number?  Didn't see this in man git cherrypick.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#6 2021-06-20 16:56:22

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 4,097

Re: How to cherry pick a PR in a git PKGBUILD using git pull [SOLVED]

A "PR number" isn't something distinctively unique from a commit. A "PR number" is in fact a branch ref, and cherry-pick accepts branch refs and resolves one (1) commit from the tip of that branch, since that's how gitrevisions(7) works.

Your --no-rebase is trying to tell "git pull" to run the "git merge" machinery. git merge accepts --no-commit too, and git pull passes that option to git merge. If you do indeed need multiple commits, then merging instead of cherry-picking may make sense... the --no-commit option is understood by both.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#7 2021-06-20 17:00:17

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 189

Re: How to cherry pick a PR in a git PKGBUILD using git pull [SOLVED]

Adding in the sources array the patch URL seems easier, no?

Then update the pkgsum or just SKIP it if it changes too frequently to bother.
Now it's straightforward to apply the patch

Last edited by icar (2021-06-20 17:00:51)

Offline

#8 2021-06-20 17:01:09

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,273
Website

Re: How to cherry pick a PR in a git PKGBUILD using git pull [SOLVED]

@icar - Yes, just wanted to learn too.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

Board footer

Powered by FluxBB