DenCowboy
DenCowboy

Reputation: 15086

Jenkins sparse checkout: only content of directory

I have a repo: hello.git. I'm able to perform a sparse checkout: sparse checkout path: /test/test1

Now I have this in my workspace:

.../workspace/test/test1/content

I want to have the following:

.../workspace/content

Is it possible to checkout only the content of the path you describe?

Upvotes: 5

Views: 6855

Answers (1)

Martin
Martin

Reputation: 4030

This is not possible in git.

When you checkout in sparse mode, git only updates entries matched by your configuration in $GIT_DIR/info/sparse-checkout (this is set by the Git plugin on Jenkins).

Git does not support changing the root of the working tree in checkout. So when you do a sparse checkout, you will always have the whole directory structure of the files you selected.

https://git-scm.com/docs/git-checkout

Upvotes: 4

Related Questions