g10k icon indicating copy to clipboard operation
g10k copied to clipboard

Support git module with both branch and ref specified

Open ekohl opened this issue 2 years ago • 2 comments

This is what puppetfile-updater generates and it makes sense. For reproducible builds you want to pin to a specific commit, but sometimes that's not on the default branch so it can help to specify the branch to generate the correct refspec.

I see there is an explicit test for this case (https://github.com/xorpaul/g10k/blob/master/tests/TestReadPuppetfileConflictingGitAttributesRef) so that does imply it's explicitly chose, but I'm not sure it really is invalid.

ekohl avatar Apr 11 '23 18:04 ekohl

Hmm, are you saying specifying a commit hash can not be unique in a git repository? Because that would be news to me.

Or what do you want to archive by specifying the branch and a commit hash of a Puppet module repository?

xorpaul avatar Apr 19 '23 11:04 xorpaul

Hmm, are you saying specifying a commit hash can not be unique in a git repository? Because that would be news to me.

No, that's not what I'm saying

Or what do you want to archive by specifying the branch and a commit hash of a Puppet module repository?

Updating is easier: if you know it which branch it came from then you can easily check if there are new commits. A commit hash can belong to multiple branches, so it's hard to figure out.

Another thing you can consider is the fetch spec. The default is something like fetch = +refs/heads/*:refs/remotes/origin/* but if you know the branch you can use fetch = +refs/heads/master:refs/remotes/origin/master and only retrieve that single branch. That can save bandwidth and make cloning faster when there are a lot of branches.

ekohl avatar Apr 19 '23 11:04 ekohl