cake-contrib / Cake_Git

Cake AddIn that extends Cake with Git features using LibGit2 and LibGit2Sharp
https://cakebuild.net/extensions/cake-git
Other
39 stars 64 forks source link

(GH-1) added alias and test for git fetch #144

Closed nils-a closed 2 years ago

nils-a commented 3 years ago

Added GitFetch for a simple fetch and GitFetchTags where TagFetchMode is set to All.

fixes #1

nils-a commented 3 years ago

@gitfool would you be in a position to take this for a spin? I'm not entirely convinced I implemented git fetch --tags correctly..

gitfool commented 3 years ago

@nils-a not really; TeamCity is a distant memory. You could probably check your implementation against actions/checkout?

savornicesei commented 3 years ago

@augustoproiete , @nils-a I'm wondering if there should be 2 GitFetch methods instead of a single one with a GitFetchSettings parameter. GHA checkout executes the following commands (for a tag):

"C:\Program Files\Git\bin\git.exe" init D:\a\testbed-actions\testbed-actions
"C:\Program Files\Git\bin\git.exe" remote add origin https://github.com/Wyam2/testbed-actions
"C:\Program Files\Git\bin\git.exe" -c protocol.version=2 fetch --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*
"C:\Program Files\Git\bin\git.exe" tag --list v1.0.0-rc4
"C:\Program Files\Git\bin\git.exe" rev-parse refs/tags/v1.0.0-rc4
"C:\Program Files\Git\bin\git.exe" -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules origin +9dd0ba78f0c7fa15015418b45812e551e11f91cd:refs/tags/v1.0.0-rc4

(see here)

As it currently is, it not possible to pass --prune. Or to fetch submodules.

Thanks, Simo

nils-a commented 3 years ago

@savornicesei I've added an overload that takes a GitFetchSettings object for more complex scenarios. This will enable setting prune during the fetch option. However, I was unable to find examples on how to fetch submodules. Any hints are welcome.