Hi!
With the git plugin, is there a way to clone a repo with the --single-branch option?
We have a freestyle job wit a Git source code, where we specify the branch as: refs/heads/main
And when the build is done, the cloned repo (the .git folder) is very big, about 2.6 GB.
We use a command line git implementation (gitforwindows.org 2.40.1).
Using command line to clone gives this values:
git clone --branch main https://server.example.com/foo/bar "C:\tmp\git test\test_xxx_branch_main"
git clone --single-branch --branch main https://server.example.com/foo/bar "C:\tmp\git test\test_xxx_branch_main_single"
The first creates a 2.6 GB .git folder, while the second a 70 MB sized .git folder.
They both also have about 120 MB of working tree files.
So about 2.4 GB is "wasted" due to unneeded cloned branches.
Is there a way to make the Jenkins git plugin to clone only the required branches?
Thanks but I already tested those:
Refspec: refs/heads/main
Honor refspec on initial clone: enabled
Shallow clone: enabled
Shallow clone depth: 1
They download a little less : 1.8 GB
The credit goes to the shallow clone option. The Honor refspec option does not seem to make any difference. Even the commands seem to be unaffected by it.
Maybe the refspec option is missing from the GUI? The example on the web has it.
Regards,
David Balažic
Lead engineer Endava
From: jenkins...@googlegroups.com <jenkins...@googlegroups.com>
On Behalf Of Mark Waite
Sent: Friday, 26 May 2023 14:17
To: Jenkins Users <jenkins...@googlegroups.com>
Subject: Re: git plugin, use --single-branch option to save disk space?
CAUTION - EXTERNAL EMAIL
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/d9b55add-c0ae-4440-ae86-0354d5082fb9n%40googlegroups.com.
(sorry for top posting, it's outlook…)
For reference, if I do the git commands manually, and replace the fetch with:
git.exe fetch -tags --force --progress -- https://server/foo/bar +refs/heads/main:refs/remotes/origin/main
then I get the small .git folder. (I replaced the two asterisks with "main")
Regards,
David Balažic
Thanks but I already tested those:
Refspec: refs/heads/main
Honor refspec on initial clone: enabled
Shallow clone: enabled
Shallow clone depth: 1
They download a little less : 1.8 GB
The credit goes to the shallow clone option. The Honor refspec option does not seem to make any difference. Even the commands seem to be unaffected by it.
Maybe the refspec option is missing from the GUI? The example on the web has it.
Thanks!
That did the trick.
David Balažic
Lead engineer Endava
From: jenkins...@googlegroups.com <jenkins...@googlegroups.com>
On Behalf Of Mark Waite
Sent: Friday, 26 May 2023 15:47
To: Jenkins Users <jenkins...@googlegroups.com>
Subject: Re: git plugin, use --single-branch option to save disk space?
CAUTION - EXTERNAL EMAIL
On Friday, May 26, 2023 at 7:23:39 AM UTC-6 David Balazic wrote:
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/833aaac1-5ba2-408f-9e02-926bfc9a747fn%40googlegroups.com.