mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 12:49:08 -04:00
feat(repository): add ability to set working directory
This commit is contained in:
parent
b603a567b2
commit
ef29257f2e
3 changed files with 25 additions and 1 deletions
|
@ -349,7 +349,7 @@ void setHeadDetachedFromAnnotated(
|
|||
}
|
||||
}
|
||||
|
||||
/// Set the path to the working directory for this repository
|
||||
/// Set the path to the working directory for this repository.
|
||||
///
|
||||
/// The working directory doesn't need to be the same one that contains the
|
||||
/// `.git` folder for this repository.
|
||||
|
|
|
@ -167,6 +167,20 @@ class Repository {
|
|||
/// If the repository is bare, this function will always return empty string.
|
||||
String get workdir => bindings.workdir(_repoPointer);
|
||||
|
||||
/// Sets the path to the working directory for this repository.
|
||||
///
|
||||
/// The working directory doesn't need to be the same one that contains the
|
||||
/// `.git` folder for this repository.
|
||||
///
|
||||
/// If this repository is bare, setting its working directory will turn it into a
|
||||
/// normal repository, capable of performing all the common workdir operations
|
||||
/// (checkout, status, index manipulation, etc).
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void setWorkdir(String path, [bool updateGitlink = false]) {
|
||||
bindings.setWorkdir(_repoPointer, path, updateGitlink);
|
||||
}
|
||||
|
||||
/// Releases memory allocated for repository object.
|
||||
void free() {
|
||||
bindings.free(_repoPointer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue