You are not logged in.

#1 2020-08-08 13:16:39

DarioP
Member
From: Geneva
Registered: 2011-01-05
Posts: 165

[Solved] How to checkout a specific commit of a git submodule

Hello,

I am making a PKGBUILD for https://github.com/DiligentGraphics/DiligentEngine
The submodules in there point to specific commits, but I need to checkout the master branch (or a different commit) of one of them (DiligentCore).

Below are the relevant sections of the PKGBUILD, what would be the proper way to edit it?

source=('git+https://github.com/DiligentGraphics/DiligentEngine.git'
        'git+https://github.com/DiligentGraphics/DiligentCore.git'
        'git+https://github.com/DiligentGraphics/DiligentFX.git'
        'git+https://github.com/DiligentGraphics/DiligentSamples.git'
        'git+https://github.com/DiligentGraphics/DiligentTools.git'
        'git+https://github.com/DiligentGraphics/SPIRV-Cross.git'
        'git+https://github.com/DiligentGraphics/SPIRV-Headers.git'
        'git+https://github.com/DiligentGraphics/SPIRV-Tools.git'
        'git+https://github.com/DiligentGraphics/glslang.git'
        'git+https://github.com/DiligentGraphics/googletest.git'
        'git+https://github.com/DiligentGraphics/imgui.git')

prepare() {
  cd "$_gitname"
  mkdir -p build
  git submodule init
  git config submodule.DiligentCore.git.url  $srcdir/DiligentCore
  git config submodule.DiligentFX.git.url    $srcdir/DiligenFX
  git config submodule.DiligentTools.git.url $srcdir/DiligenTools
  git submodule update
  cd "DiligentCore/ThirdParty"
  git submodule init
  git config submodule.SPIRV-Cross.git.url   $srcdir/DiligentCore/ThirdParty/SPIRV-Cross
  git config submodule.SPIRV-Headers.git.url $srcdir/DiligentCore/ThirdParty/SPIRV-Headers
  git config submodule.SPIRV-Tools.git.url   $srcdir/DiligentCore/ThirdParty/SPIRV-Tools
  git config submodule.glslang.git.url       $srcdir/DiligentCore/ThirdParty/glslang
  git config submodule.googletest.git.url    $srcdir/DiligentCore/ThirdParty/googletest
  git submodule update
  cd "../../DiligentTools/ThirdParty"
  git submodule init
  git config submodule.imgui.git.url         $srcdir/DiligentTools/ThirdParty/imgui
  git submodule update
}

Last edited by DarioP (2020-08-08 13:47:33)

Offline

#2 2020-08-08 13:22:22

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

Re: [Solved] How to checkout a specific commit of a git submodule

You can define a commit and have makepkg build it, see: https://github.com/archlinux/svntogit-p … GBUILD#L45


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

Offline

#3 2020-08-08 13:33:57

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: [Solved] How to checkout a specific commit of a git submodule

The submodule commit is set in the main git repo. if you need to change it, you have to use git to update it. There's plenty of info on the internet on how to update submodules.

You do NOT set it with the source array URL.

Offline

#4 2020-08-08 13:46:31

DarioP
Member
From: Geneva
Registered: 2011-01-05
Posts: 165

Re: [Solved] How to checkout a specific commit of a git submodule

Scimmia wrote:

You do NOT set it with the source array URL.

I agree, editing the sources has no effect on submodules.

After a quick google search I got it done by simply replacing

git submodule update

with:

git submodule update --remote --merge

in the prepare() function.

Thank you!

Offline

Board footer

Powered by FluxBB