You are not logged in.

#1 2023-03-05 10:22:02

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

Pulling a PR in a git package

I would like to apply this PR within the prepare function of kodi-nexus-git.  In the past I would use something like this:

prepare() {
...
  git pull --no-edit origin pull/22897/head
}

Doing so here seems to pull in way more than the intended code spelled out in the PR.  What am I doing wrong?


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

Offline

#2 2023-03-05 10:48:40

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,315
Website

Re: Pulling a PR in a git package

Download the patch as a source and apply it as a patch in prepare()?


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2023-03-05 12:49:47

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

Re: Pulling a PR in a git package

Applying the patch works but I would like to know why my git invocation is not behaving as I think it should and how to correct it.  I used with other PKGBUILDs successfully.  It has to be failing here because the PR is against master but the build is against other branch (Nexus).  What is the right syntax?

Example of it working in the kodi-git PKGBUILD.

Last edited by graysky (2023-03-05 12:52:49)


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

Offline

#4 2023-03-05 14:09:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,217
Website

Re: Pulling a PR in a git package

I suck at git, but a quick glance at the first paragraph of the man page gives a suggestion that looks like it should do what you want:

man git-pull (emphasis added) wrote:

If the current branch is behind the remote, then by default it will fast-forward the current branch to match the remote. If the current branch and the remote have diverged, the user needs to specify how to reconcile the divergent branches with --rebase or --no-rebase

Last edited by Trilby (2023-03-05 14:10:16)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2023-03-05 16:30:58

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

Re: Pulling a PR in a git package

Thanks for the reply, Trilby.  Neither option works.

The --rebase option is angry due to commits pending it seems:

git pull --rebase origin pull/22897/head
error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.
==> ERROR: A failure occurred in prepare().
    Aborting...

And --no-rebase seems to pull in way more changes than are scoped in the PR.  This is similar to how no specifying either behaves:

 git pull --no-rebase origin pull/22897/head
From /incoming/src/xbmc
 * branch                    refs/pull/22897/head -> FETCH_HEAD
Auto-merging addons/resource.language.en_gb/resources/strings.po
Auto-merging cmake/modules/FindLibDvdCSS.cmake
Auto-merging system/keymaps/customcontroller.SiriRemote.xml
Auto-merging system/keymaps/keyboard.xml
Auto-merging system/settings/settings.xml
Auto-merging tools/android/packaging/Makefile.in
Auto-merging tools/android/packaging/xbmc/build.gradle.in
Auto-merging tools/depends/target/ffmpeg/CMakeLists.txt
Auto-merging tools/depends/target/libass/Makefile
Auto-merging tools/depends/target/libcdio-gplv3/Makefile
Auto-merging tools/depends/target/libmicrohttpd/Makefile
Auto-merging tools/depends/target/python3/Makefile
Auto-merging version.txt
CONFLICT (content): Merge conflict in version.txt
...

Last edited by graysky (2023-03-05 16:31:23)


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

Offline

#6 2023-03-05 21:53:19

loqs
Member
Registered: 2014-03-06
Posts: 17,898

Re: Pulling a PR in a git package

I see you switched to git cherry-pick which I think is a better solution.  So just for reference I was not able to achieve what you wanted using git pull,  I had to split it into a fetch and a rebase:

git fetch origin pull/22897/head:pull/22897
git rebase --keep-base makepkg pull/22897

Last edited by loqs (2023-03-05 21:53:48)

Offline

#7 2023-03-05 23:37:57

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

Re: Pulling a PR in a git package

Thanks for the help, loqs. Good to keep that under your hat.


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

Offline

Board footer

Powered by FluxBB