swellaby / vsts-mirror-git-repository

A straightforward utility to mirror one Git repository to another location
MIT License
25 stars 15 forks source link

selective cloning of folders in git repository #62

Open RajatUC opened 4 years ago

RajatUC commented 4 years ago

Hi, Is it possible to copy/clone selected folders from a source repo to target repo in Azure Devops pipieline ? I have to copy pipeline, dataset & dataflow folders from dev ADF to Prod ADF such that I get all the pipelines from Dev environment but use linked service of prod environment.
Please let me know if some changes in the code can help do that.
Ref: http://scriptedonachip.com/git-sparse-checkout

Thanks, Raj

calebcartwright commented 4 years ago

Thanks for the question @RajatUC!

The purpose of the mirror task currently provided by this extension is to wrap and simplify the utilization of git's mirror functionality, and git's mirror functionality is for ensuring that all the refs from the source repository are synced over to the destination repository.

As such, the subset/selective scenario of only certain folders is incompatible with a full mirror, and is not something that would make sense to add to the git mirror task.

However, we'd be open to considering including a new task that could be bundled with this extension (along with the current/existing mirror task) that would provide other git capabilities which could support such a use case.

If you (or anyone else) is willing to submit a PR with such a new task we'll definitely be happy to review and work on getting it published, but I don't see any of us on the maintainer team developing this new task (at least not for a very long time)

calebcartwright commented 4 years ago

cc @traviskosarek - assume you wouldn't have any objections to adding an additional task to the ext as detailed above?

traviskosarek commented 4 years ago

@calebcartwright No objections here to adding additional tasks for mirror-like capabilities.

As you mentioned above, I'm not sure if selective mirroring is something git is capable of out of the box, so it would definitely require a bit of logic to maintain the references to commits/etc that pertain to that specific folder path.

I personally don't have the bandwidth to take this on, but I think it would be useful functionality if selective mirroring is a common use case. I'd be glad to review a PR and help test this out!