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?

I realize the plugin uses different commands, but hope the idea is doable.


For reference,
I have Jenkins 2.387.2 on Windows Server 2019
Git plugin 5.0.2
Git implementation: gitforwindows.org 2.40.1
I also tried with JGit (it behaves the same, uses 2.6GB per clone)


Also, the commands used in the build job are:

> git.exe init C:\ProgramData\Jenkins\.jenkins\workspace\TEST build git branch 
> one # timeout=10
> git.exe --version # timeout=10
> git.exe fetch --no-tags --force --progress --depth=1 -- 
> https://server.example.com/foo/bar.git +refs/heads/*:refs/remotes/origin/* # 
> timeout=10

I suspect the asterisk in the last command makes it download more than I need, 
but I'm no git expert.


Lep pozdrav,
David Balažic





The information in this email is confidential and may be legally privileged. It 
is intended solely for the addressee. Any opinions expressed are mine and do 
not necessarily represent the opinions of the Company. Emails are susceptible 
to interference. If you are not the intended recipient, any disclosure, 
copying, distribution or any action taken or omitted to be taken in reliance on 
it, is strictly prohibited and may be unlawful. If you have received this 
message in error, do not open any attachments but please notify the Endava 
Service Desk on (+44 (0)870 423 0187), and delete this message from your 
system. The sender accepts no responsibility for information, errors or 
omissions in this email, or for its use or misuse, or for any act committed or 
omitted in connection with this communication. If in doubt, please verify the 
authenticity of the contents with the sender. Please rely on your own virus 
checkers as no responsibility is taken by the sender for any damage rising out 
of any bug or virus infection.

Endava plc is a company registered in England under company number 5722669 
whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United 
Kingdom. Endava plc is the Endava group holding company and does not provide 
any services to clients. Each of Endava plc and its subsidiaries is a separate 
legal entity and has no liability for another such entity's acts or omissions.

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/VI1PR06MB43525402AF3F7E865BF5256D82479%40VI1PR06MB4352.eurprd06.prod.outlook.com.

Reply via email to