Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add target directory to checkout options #1665

Merged
merged 3 commits into from Jun 21, 2013

Conversation

arrbee
Copy link
Member

@arrbee arrbee commented Jun 21, 2013

This adds the ability for checkout to write to a target directory instead of having to use the working directory of the repository. This makes it easier to do exports of repository data or to extract a commit from a bare repo and so on. There is a new target_directory field in the git_checkout_options structure.

This is similar to, but not quite the same as, the --prefix option to git checkout-index (this will always be treated as a directory name, not just as a simple text prefix).

As part of this, the workdir iterator was extended to take the path to the working directory as a parameter and fallback on the git_repository_workdir result only if it's not specified.

Fixes issue #1332

This adds the ability for checkout to write to a target directory
instead of having to use the working directory of the repository.
This makes it easier to do exports of repository data and the like.

This is similar to, but not quite the same as, the --prefix option
to `git checkout-index` (this will always be treated as a directory
name, not just as a simple text prefix).

As part of this, the workdir iterator was extended to take the
path to the working directory as a parameter and fallback on the
git_repository_workdir result only if it's not specified.

Fixes libgit2#1332
With the new target directory option to checkout, the non-bareness
of the repository should be checked much later in the parameter
validation process - actually that check was already in place, but
I was doing it redundantly in the checkout APIs.

This removes the now unnecessary early check for bare repos.  It
also adds some other parameter validation and makes it so that
implied parameters can actually be passed as NULL (i.e. if you
pass a git_index, you don't have to pass the git_repository - we
can get it from index).
This adds additonal tests of the checkout target directory option
including using it to dump data from bare repos.
vmg pushed a commit that referenced this pull request Jun 21, 2013
Add target directory to checkout options
@vmg vmg merged commit 5d669f0 into libgit2:development Jun 21, 2013
@arrbee arrbee deleted the checkout-target-directory branch November 22, 2013 08:26
phatblat pushed a commit to phatblat/libgit2 that referenced this pull request Sep 13, 2014
Add target directory to checkout options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants