mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-06-23 09:19:26 -04:00
style: avoid lines longer than 80 characters
This commit is contained in:
parent
a806d0a312
commit
7b14ee6b9b
76 changed files with 1246 additions and 972 deletions
|
@ -5,8 +5,9 @@ import 'libgit2_bindings.dart';
|
|||
|
||||
/// Look up the value of one git attribute for path.
|
||||
///
|
||||
/// Returned value can be either `true`, `false`, `null` (if the attribute was not set at all),
|
||||
/// or a [String] value, if the attribute was set to an actual string.
|
||||
/// Returned value can be either `true`, `false`, `null` (if the attribute was
|
||||
/// not set at all), or a [String] value, if the attribute was set to an actual
|
||||
/// string.
|
||||
Object? getAttribute({
|
||||
required Pointer<git_repository> repoPointer,
|
||||
required int flags,
|
||||
|
|
|
@ -79,7 +79,8 @@ Pointer<git_blame_hunk> getHunkByIndex({
|
|||
}
|
||||
}
|
||||
|
||||
/// Gets the hunk that relates to the given line number (1-based) in the newest commit.
|
||||
/// Gets the hunk that relates to the given line number (1-based) in the newest
|
||||
/// commit.
|
||||
///
|
||||
/// Throws [RangeError] if [lineNumber] is out of range.
|
||||
Pointer<git_blame_hunk> getHunkByLine({
|
||||
|
|
|
@ -39,8 +39,8 @@ bool isBinary(Pointer<git_blob> blob) {
|
|||
/// Get a read-only buffer with the raw content of a blob.
|
||||
///
|
||||
/// A pointer to the raw content of a blob is returned; this pointer is owned
|
||||
/// internally by the object and shall not be free'd. The pointer may be invalidated
|
||||
/// at a later time.
|
||||
/// internally by the object and shall not be free'd. The pointer may be
|
||||
/// invalidated at a later time.
|
||||
String content(Pointer<git_blob> blob) {
|
||||
return libgit2.git_blob_rawcontent(blob).cast<Utf8>().toDartString();
|
||||
}
|
||||
|
@ -101,7 +101,8 @@ Pointer<git_oid> createFromWorkdir({
|
|||
}
|
||||
}
|
||||
|
||||
/// Read a file from the filesystem and write its content to the Object Database as a loose blob.
|
||||
/// Read a file from the filesystem and write its content to the Object
|
||||
/// Database as a loose blob.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_oid> createFromDisk({
|
||||
|
|
|
@ -48,7 +48,8 @@ List<Pointer<git_reference>> list({
|
|||
|
||||
/// Lookup a branch by its name in a repository.
|
||||
///
|
||||
/// The generated reference must be freed by the user. The branch name will be checked for validity.
|
||||
/// The generated reference must be freed by the user. The branch name will be
|
||||
/// checked for validity.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_reference> lookup({
|
||||
|
@ -78,7 +79,8 @@ Pointer<git_reference> lookup({
|
|||
/// Create a new branch pointing at a target commit.
|
||||
///
|
||||
/// A new direct reference will be created pointing to this target commit.
|
||||
/// If force is true and a reference already exists with the given name, it'll be replaced.
|
||||
/// If force is true and a reference already exists with the given name, it'll
|
||||
/// be replaced.
|
||||
///
|
||||
/// The returned reference must be freed by the user.
|
||||
///
|
||||
|
@ -167,8 +169,8 @@ bool isHead(Pointer<git_reference> branch) {
|
|||
|
||||
/// Determine if any HEAD points to the current branch.
|
||||
///
|
||||
/// This will iterate over all known linked repositories (usually in the form of worktrees)
|
||||
/// and report whether any HEAD is pointing at the current branch.
|
||||
/// This will iterate over all known linked repositories (usually in the form
|
||||
/// of worktrees) and report whether any HEAD is pointing at the current branch.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
bool isCheckedOut(Pointer<git_reference> branch) {
|
||||
|
|
|
@ -6,13 +6,14 @@ import '../error.dart';
|
|||
import '../util.dart';
|
||||
import 'libgit2_bindings.dart';
|
||||
|
||||
/// Updates files in the index and the working tree to match the content of the commit
|
||||
/// pointed at by HEAD.
|
||||
/// Updates files in the index and the working tree to match the content of the
|
||||
/// commit pointed at by HEAD.
|
||||
///
|
||||
/// Note that this is not the correct mechanism used to switch branches; do not change
|
||||
/// your HEAD and then call this method, that would leave you with checkout conflicts
|
||||
/// since your working directory would then appear to be dirty. Instead, checkout the
|
||||
/// target of the branch and then update HEAD using `setHead` to point to the branch you checked out.
|
||||
/// Note that this is not the correct mechanism used to switch branches; do not
|
||||
/// change your HEAD and then call this method, that would leave you with
|
||||
/// checkout conflicts since your working directory would then appear to be
|
||||
/// dirty. Instead, checkout the target of the branch and then update HEAD
|
||||
/// using [setHead] to point to the branch you checked out.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void head({
|
||||
|
|
|
@ -26,14 +26,15 @@ Pointer<git_commit> lookup({
|
|||
}
|
||||
}
|
||||
|
||||
/// Creates an annotated commit from the given commit id. The resulting annotated commit
|
||||
/// must be freed with [annotatedFree].
|
||||
/// Creates an annotated commit from the given commit id. The resulting
|
||||
/// annotated commit must be freed with [annotatedFree].
|
||||
///
|
||||
/// An annotated commit contains information about how it was looked up, which may be useful
|
||||
/// for functions like merge or rebase to provide context to the operation. For example, conflict
|
||||
/// files will include the name of the source or target branches being merged. It is therefore
|
||||
/// preferable to use the most specific function (eg git_annotated_commit_from_ref) instead of
|
||||
/// this one when that data is known.
|
||||
/// An annotated commit contains information about how it was looked up, which
|
||||
/// may be useful for functions like merge or rebase to provide context to the
|
||||
/// operation. For example, conflict files will include the name of the source
|
||||
/// or target branches being merged. It is therefore preferable to use the most
|
||||
/// specific function (eg git_annotated_commit_from_ref) instead of this one
|
||||
/// when that data is known.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<Pointer<git_annotated_commit>> annotatedLookup({
|
||||
|
@ -117,13 +118,15 @@ Pointer<git_oid> create({
|
|||
|
||||
/// Amend an existing commit by replacing only non-null values.
|
||||
///
|
||||
/// This creates a new commit that is exactly the same as the old commit, except that
|
||||
/// any non-null values will be updated. The new commit has the same parents as the old commit.
|
||||
/// This creates a new commit that is exactly the same as the old commit,
|
||||
/// except that any non-null values will be updated. The new commit has the
|
||||
/// same parents as the old commit.
|
||||
///
|
||||
/// The [updateRef] value works as in the regular [create], updating the ref to point to
|
||||
/// the newly rewritten commit. If you want to amend a commit that is not currently
|
||||
/// the tip of the branch and then rewrite the following commits to reach a ref, pass
|
||||
/// this as null and update the rest of the commit chain and ref separately.
|
||||
/// The [updateRef] value works as in the regular [create], updating the ref to
|
||||
/// point to the newly rewritten commit. If you want to amend a commit that is
|
||||
/// not currently the tip of the branch and then rewrite the following commits
|
||||
/// to reach a ref, pass this as null and update the rest of the commit chain
|
||||
/// and ref separately.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_oid> amend({
|
||||
|
@ -165,7 +168,8 @@ Pointer<git_oid> amend({
|
|||
}
|
||||
}
|
||||
|
||||
/// Get the encoding for the message of a commit, as a string representing a standard encoding name.
|
||||
/// Get the encoding for the message of a commit, as a string representing a
|
||||
/// standard encoding name.
|
||||
///
|
||||
/// The encoding may be NULL if the encoding header in the commit is missing;
|
||||
/// in that case UTF-8 is assumed.
|
||||
|
@ -176,7 +180,8 @@ String messageEncoding(Pointer<git_commit> commit) {
|
|||
|
||||
/// Get the full message of a commit.
|
||||
///
|
||||
/// The returned message will be slightly prettified by removing any potential leading newlines.
|
||||
/// The returned message will be slightly prettified by removing any potential
|
||||
/// leading newlines.
|
||||
String message(Pointer<git_commit> commit) {
|
||||
return libgit2.git_commit_message(commit).cast<Utf8>().toDartString();
|
||||
}
|
||||
|
@ -217,10 +222,10 @@ Pointer<git_oid> tree(Pointer<git_commit> commit) {
|
|||
return libgit2.git_commit_tree_id(commit);
|
||||
}
|
||||
|
||||
/// Reverts the given commit against the given "our" commit, producing an index that
|
||||
/// reflects the result of the revert.
|
||||
/// Reverts the given commit against the given "our" commit, producing an index
|
||||
/// that reflects the result of the revert.
|
||||
///
|
||||
/// The returned index must be freed explicitly with `free()`.
|
||||
/// The returned index must be freed explicitly with [free].
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_index> revertCommit({
|
||||
|
|
|
@ -106,9 +106,9 @@ String findXdg() {
|
|||
|
||||
/// Create a snapshot of the configuration.
|
||||
///
|
||||
/// Create a snapshot of the current state of a configuration, which allows you to look
|
||||
/// into a consistent view of the configuration for looking up complex values
|
||||
/// (e.g. a remote, submodule).
|
||||
/// Create a snapshot of the current state of a configuration, which allows you
|
||||
/// to look into a consistent view of the configuration for looking up complex
|
||||
/// values (e.g. a remote, submodule).
|
||||
Pointer<git_config> snapshot(Pointer<git_config> config) {
|
||||
final out = calloc<Pointer<git_config>>();
|
||||
libgit2.git_config_snapshot(out, config);
|
||||
|
|
|
@ -10,7 +10,8 @@ import 'libgit2_bindings.dart';
|
|||
///
|
||||
/// Perform the describe operation on the given committish object.
|
||||
///
|
||||
/// Returned object should be freed with `describeResultFree()` once no longer needed.
|
||||
/// Returned object should be freed with `describeResultFree()` once no longer
|
||||
/// needed.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_describe_result> commit({
|
||||
|
|
|
@ -130,11 +130,12 @@ int length(Pointer<git_diff> diff) => libgit2.git_diff_num_deltas(diff);
|
|||
|
||||
/// Merge one diff into another.
|
||||
///
|
||||
/// This merges items from the "from" list into the "onto" list. The resulting diff
|
||||
/// will have all items that appear in either list. If an item appears in both lists,
|
||||
/// then it will be "merged" to appear as if the old version was from the "onto" list
|
||||
/// and the new version is from the "from" list (with the exception that if the item
|
||||
/// has a pending DELETE in the middle, then it will show as deleted).
|
||||
/// This merges items from the "from" list into the "onto" list. The resulting
|
||||
/// diff will have all items that appear in either list. If an item appears in
|
||||
/// both lists, then it will be "merged" to appear as if the old version was
|
||||
/// from the "onto" list and the new version is from the "from" list (with the
|
||||
/// exception that if the item has a pending DELETE in the middle, then it will
|
||||
/// show as deleted).
|
||||
void merge({
|
||||
required Pointer<git_diff> ontoPointer,
|
||||
required Pointer<git_diff> fromPointer,
|
||||
|
@ -144,13 +145,15 @@ void merge({
|
|||
|
||||
/// Read the contents of a git patch file into a git diff object.
|
||||
///
|
||||
/// The diff object produced is similar to the one that would be produced if you actually
|
||||
/// produced it computationally by comparing two trees, however there may be subtle differences.
|
||||
/// For example, a patch file likely contains abbreviated object IDs, so the object IDs in a
|
||||
/// diff delta produced by this function will also be abbreviated.
|
||||
/// The diff object produced is similar to the one that would be produced if
|
||||
/// you actually produced it computationally by comparing two trees, however
|
||||
/// there may be subtle differences. For example, a patch file likely contains
|
||||
/// abbreviated object IDs, so the object IDs in a diff delta produced by this
|
||||
/// function will also be abbreviated.
|
||||
///
|
||||
/// This function will only read patch files created by a git implementation, it will not
|
||||
/// read unified diffs produced by the `diff` program, nor any other types of patch files.
|
||||
/// This function will only read patch files created by a git implementation,
|
||||
/// it will not read unified diffs produced by the `diff` program, nor any
|
||||
/// other types of patch files.
|
||||
Pointer<git_diff> parse(String content) {
|
||||
final out = calloc<Pointer<git_diff>>();
|
||||
final contentC = content.toNativeUtf8().cast<Int8>();
|
||||
|
@ -163,9 +166,10 @@ Pointer<git_diff> parse(String content) {
|
|||
|
||||
/// Transform a diff marking file renames, copies, etc.
|
||||
///
|
||||
/// This modifies a diff in place, replacing old entries that look like renames or copies
|
||||
/// with new entries reflecting those changes. This also will, if requested, break modified
|
||||
/// files into add/remove pairs if the amount of change is above a threshold.
|
||||
/// This modifies a diff in place, replacing old entries that look like renames
|
||||
/// or copies with new entries reflecting those changes. This also will, if
|
||||
/// requested, break modified files into add/remove pairs if the amount of
|
||||
/// change is above a threshold.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void findSimilar({
|
||||
|
@ -198,12 +202,13 @@ void findSimilar({
|
|||
|
||||
/// Calculate the patch ID for the given patch.
|
||||
///
|
||||
/// Calculate a stable patch ID for the given patch by summing the hash of the file diffs,
|
||||
/// ignoring whitespace and line numbers. This can be used to derive whether two diffs are
|
||||
/// the same with a high probability.
|
||||
/// Calculate a stable patch ID for the given patch by summing the hash of the
|
||||
/// file diffs, ignoring whitespace and line numbers. This can be used to
|
||||
/// derive whether two diffs are the same with a high probability.
|
||||
///
|
||||
/// Currently, this function only calculates stable patch IDs, as defined in `git-patch-id(1)`,
|
||||
/// and should in fact generate the same IDs as the upstream git project does.
|
||||
/// Currently, this function only calculates stable patch IDs, as defined in
|
||||
/// `git-patch-id(1)`, and should in fact generate the same IDs as the upstream
|
||||
/// git project does.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_oid> patchOid(Pointer<git_diff> diff) {
|
||||
|
@ -228,10 +233,10 @@ Pointer<git_diff_delta> getDeltaByIndex({
|
|||
|
||||
/// Look up the single character abbreviation for a delta status code.
|
||||
///
|
||||
/// When you run `git diff --name-status` it uses single letter codes in the output such as
|
||||
/// 'A' for added, 'D' for deleted, 'M' for modified, etc. This function converts a [GitDelta]
|
||||
/// value into these letters for your own purposes. [GitDelta.untracked] will return
|
||||
/// a space (i.e. ' ').
|
||||
/// When you run `git diff --name-status` it uses single letter codes in the
|
||||
/// output such as 'A' for added, 'D' for deleted, 'M' for modified, etc. This
|
||||
/// function converts a [GitDelta] value into these letters for your own
|
||||
/// purposes. [GitDelta.untracked] will return a space (i.e. ' ').
|
||||
String statusChar(int status) {
|
||||
return String.fromCharCode(libgit2.git_diff_status_char(status));
|
||||
}
|
||||
|
@ -294,8 +299,8 @@ Pointer<git_buf> addToBuf({
|
|||
return bufferPointer;
|
||||
}
|
||||
|
||||
/// Apply a diff to the given repository, making changes directly in the working directory,
|
||||
/// the index, or both.
|
||||
/// Apply a diff to the given repository, making changes directly in the
|
||||
/// working directory, the index, or both.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
bool apply({
|
||||
|
|
|
@ -32,9 +32,10 @@ bool descendantOf({
|
|||
|
||||
/// Count the number of unique commits between two commit objects.
|
||||
///
|
||||
/// There is no need for branches containing the commits to have any upstream relationship,
|
||||
/// but it helps to think of one as a branch and the other as its upstream, the ahead and
|
||||
/// behind values will be what git would report for the branches.
|
||||
/// There is no need for branches containing the commits to have any upstream
|
||||
/// relationship, but it helps to think of one as a branch and the other as its
|
||||
/// upstream, the ahead and behind values will be what git would report for the
|
||||
/// branches.
|
||||
List<int> aheadBehind({
|
||||
required Pointer<git_repository> repoPointer,
|
||||
required Pointer<git_oid> localPointer,
|
||||
|
|
|
@ -6,16 +6,17 @@ import '../error.dart';
|
|||
import '../util.dart';
|
||||
import 'libgit2_bindings.dart';
|
||||
|
||||
/// Update the contents of an existing index object in memory by reading from the hard disk.
|
||||
/// Update the contents of an existing index object in memory by reading from
|
||||
/// the hard disk.
|
||||
///
|
||||
/// If force is true, this performs a "hard" read that discards in-memory changes and
|
||||
/// always reloads the on-disk index data. If there is no on-disk version,
|
||||
/// the index will be cleared.
|
||||
/// If force is true, this performs a "hard" read that discards in-memory
|
||||
/// changes and always reloads the on-disk index data. If there is no on-disk
|
||||
/// version, the index will be cleared.
|
||||
///
|
||||
/// If force is false, this does a "soft" read that reloads the index data from disk only
|
||||
/// if it has changed since the last time it was loaded. Purely in-memory index data
|
||||
/// will be untouched. Be aware: if there are changes on disk, unwritten in-memory changes
|
||||
/// are discarded.
|
||||
/// If force is false, this does a "soft" read that reloads the index data from
|
||||
/// disk only if it has changed since the last time it was loaded. Purely
|
||||
/// in-memory index data will be untouched. Be aware: if there are changes on
|
||||
/// disk, unwritten in-memory changes are discarded.
|
||||
void read({required Pointer<git_index> indexPointer, required bool force}) {
|
||||
final forceC = force == true ? 1 : 0;
|
||||
libgit2.git_index_read(indexPointer, forceC);
|
||||
|
@ -33,11 +34,13 @@ void readTree({
|
|||
|
||||
/// Write the index as a tree.
|
||||
///
|
||||
/// This method will scan the index and write a representation of its current state back to disk;
|
||||
/// it recursively creates tree objects for each of the subtrees stored in the index, but only
|
||||
/// returns the OID of the root tree. This is the OID that can be used e.g. to create a commit.
|
||||
/// This method will scan the index and write a representation of its current
|
||||
/// state back to disk; it recursively creates tree objects for each of the
|
||||
/// subtrees stored in the index, but only returns the OID of the root tree.
|
||||
/// This is the OID that can be used e.g. to create a commit.
|
||||
///
|
||||
/// The index instance cannot be bare, and needs to be associated to an existing repository.
|
||||
/// The index instance cannot be bare, and needs to be associated to an
|
||||
/// existing repository.
|
||||
///
|
||||
/// The index must not contain any file in conflict.
|
||||
///
|
||||
|
@ -56,8 +59,8 @@ Pointer<git_oid> writeTree(Pointer<git_index> index) {
|
|||
|
||||
/// Write the index as a tree to the given repository.
|
||||
///
|
||||
/// This method will do the same as [writeTree], but letting the user choose the repository
|
||||
/// where the tree will be written.
|
||||
/// This method will do the same as [writeTree], but letting the user choose
|
||||
/// the repository where the tree will be written.
|
||||
///
|
||||
/// The index must not contain any file in conflict.
|
||||
///
|
||||
|
@ -77,7 +80,8 @@ Pointer<git_oid> writeTreeTo({
|
|||
}
|
||||
}
|
||||
|
||||
/// Find the first position of any entries which point to given path in the Git index.
|
||||
/// Find the first position of any entries which point to given path in the Git
|
||||
/// index.
|
||||
bool find({required Pointer<git_index> indexPointer, required String path}) {
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final result = libgit2.git_index_find(nullptr, indexPointer, pathC);
|
||||
|
@ -132,8 +136,8 @@ Pointer<git_index_entry> getByPath({
|
|||
|
||||
/// Clear the contents (all the entries) of an index object.
|
||||
///
|
||||
/// This clears the index object in memory; changes must be explicitly written to
|
||||
/// disk for them to take effect persistently.
|
||||
/// This clears the index object in memory; changes must be explicitly written
|
||||
/// to disk for them to take effect persistently.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void clear(Pointer<git_index> index) {
|
||||
|
@ -146,8 +150,9 @@ void clear(Pointer<git_index> index) {
|
|||
|
||||
/// Add or update an index entry from an in-memory struct.
|
||||
///
|
||||
/// If a previous index entry exists that has the same path and stage as the given `sourceEntry`,
|
||||
/// it will be replaced. Otherwise, the `sourceEntry` will be added.
|
||||
/// If a previous index entry exists that has the same path and stage as the
|
||||
/// given `sourceEntry`, it will be replaced. Otherwise, the `sourceEntry` will
|
||||
/// be added.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void add({
|
||||
|
@ -163,15 +168,17 @@ void add({
|
|||
|
||||
/// Add or update an index entry from a file on disk.
|
||||
///
|
||||
/// The file path must be relative to the repository's working folder and must be readable.
|
||||
/// The file path must be relative to the repository's working folder and must
|
||||
/// be readable.
|
||||
///
|
||||
/// This method will fail in bare index instances.
|
||||
///
|
||||
/// This forces the file to be added to the index, not looking at gitignore rules.
|
||||
/// This forces the file to be added to the index, not looking at gitignore
|
||||
/// rules.
|
||||
///
|
||||
/// If this file currently is the result of a merge conflict, this file will no longer be
|
||||
/// marked as conflicting. The data about the conflict will be moved to the "resolve undo"
|
||||
/// (REUC) section.
|
||||
/// If this file currently is the result of a merge conflict, this file will no
|
||||
/// longer be marked as conflicting. The data about the conflict will be moved
|
||||
/// to the "resolve undo" (REUC) section.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void addByPath({
|
||||
|
@ -192,9 +199,10 @@ void addByPath({
|
|||
///
|
||||
/// This method will fail in bare index instances.
|
||||
///
|
||||
/// The `pathspec` is a list of file names or shell glob patterns that will be matched
|
||||
/// against files in the repository's working directory. Each file that matches will be
|
||||
/// added to the index (either updating an existing entry or adding a new entry).
|
||||
/// The `pathspec` is a list of file names or shell glob patterns that will be
|
||||
/// matched against files in the repository's working directory. Each file that
|
||||
/// matches will be added to the index (either updating an existing entry or
|
||||
/// adding a new entry).
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void addAll({
|
||||
|
@ -232,7 +240,8 @@ void addAll({
|
|||
}
|
||||
}
|
||||
|
||||
/// Write an existing index object from memory back to disk using an atomic file lock.
|
||||
/// Write an existing index object from memory back to disk using an atomic
|
||||
/// file lock.
|
||||
void write(Pointer<git_index> index) => libgit2.git_index_write(index);
|
||||
|
||||
/// Remove an entry from the index.
|
||||
|
|
|
@ -25,8 +25,8 @@ Pointer<git_oid> mergeBase({
|
|||
}
|
||||
}
|
||||
|
||||
/// Analyzes the given branch(es) and determines the opportunities for merging them
|
||||
/// into a reference.
|
||||
/// Analyzes the given branch(es) and determines the opportunities for merging
|
||||
/// them into a reference.
|
||||
List<int> analysis({
|
||||
required Pointer<git_repository> repoPointer,
|
||||
required Pointer<git_reference> ourRefPointer,
|
||||
|
@ -52,10 +52,10 @@ List<int> analysis({
|
|||
return result;
|
||||
}
|
||||
|
||||
/// Merges the given commit(s) into HEAD, writing the results into the working directory.
|
||||
/// Any changes are staged for commit and any conflicts are written to the index. Callers
|
||||
/// should inspect the repository's index after this completes, resolve any conflicts and
|
||||
/// prepare a commit.
|
||||
/// Merges the given commit(s) into HEAD, writing the results into the working
|
||||
/// directory. Any changes are staged for commit and any conflicts are written
|
||||
/// to the index. Callers should inspect the repository's index after this
|
||||
/// completes, resolve any conflicts and prepare a commit.
|
||||
void merge({
|
||||
required Pointer<git_repository> repoPointer,
|
||||
required Pointer<Pointer<git_annotated_commit>> theirHeadsPointer,
|
||||
|
@ -84,8 +84,8 @@ void merge({
|
|||
}
|
||||
|
||||
/// Merge two files as they exist in the index, using the given common ancestor
|
||||
/// as the baseline, producing a string that reflects the merge result containing
|
||||
/// possible conflicts.
|
||||
/// as the baseline, producing a string that reflects the merge result
|
||||
/// containing possible conflicts.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
String mergeFileFromIndex({
|
||||
|
@ -114,10 +114,10 @@ String mergeFileFromIndex({
|
|||
}
|
||||
}
|
||||
|
||||
/// Merge two commits, producing a git_index that reflects the result of the merge.
|
||||
/// The index may be written as-is to the working directory or checked out. If the index
|
||||
/// is to be converted to a tree, the caller should resolve any conflicts that arose as
|
||||
/// part of the merge.
|
||||
/// Merge two commits, producing a git_index that reflects the result of the
|
||||
/// merge. The index may be written as-is to the working directory or checked
|
||||
/// out. If the index is to be converted to a tree, the caller should resolve
|
||||
/// any conflicts that arose as part of the merge.
|
||||
///
|
||||
/// The returned index must be freed explicitly.
|
||||
///
|
||||
|
@ -155,10 +155,10 @@ Pointer<git_index> mergeCommits({
|
|||
}
|
||||
}
|
||||
|
||||
/// Merge two trees, producing a git_index that reflects the result of the merge.
|
||||
/// The index may be written as-is to the working directory or checked out. If the index
|
||||
/// is to be converted to a tree, the caller should resolve any conflicts that arose as part
|
||||
/// of the merge.
|
||||
/// Merge two trees, producing a git_index that reflects the result of the
|
||||
/// merge. The index may be written as-is to the working directory or checked
|
||||
/// out. If the index is to be converted to a tree, the caller should resolve
|
||||
/// any conflicts that arose as part of the merge.
|
||||
///
|
||||
/// The returned index must be freed explicitly.
|
||||
///
|
||||
|
@ -198,7 +198,8 @@ Pointer<git_index> mergeTrees({
|
|||
}
|
||||
}
|
||||
|
||||
/// Cherry-pick the given commit, producing changes in the index and working directory.
|
||||
/// Cherry-pick the given commit, producing changes in the index and working
|
||||
/// directory.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void cherryPick({
|
||||
|
|
|
@ -14,9 +14,9 @@ int type(Pointer<git_object> obj) => libgit2.git_object_type(obj);
|
|||
/// The generated reference is owned by the repository and should be closed with
|
||||
/// the `free()` method instead of free'd manually.
|
||||
///
|
||||
/// The 'type' parameter must match the type of the object in the odb; the method will
|
||||
/// fail otherwise. The special value 'GIT_OBJECT_ANY' may be passed to let the method
|
||||
/// guess the object's type.
|
||||
/// The 'type' parameter must match the type of the object in the odb; the
|
||||
/// method will fail otherwise. The special value 'GIT_OBJECT_ANY' may be
|
||||
/// passed to let the method guess the object's type.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_object> lookup({
|
||||
|
@ -37,8 +37,8 @@ Pointer<git_object> lookup({
|
|||
|
||||
/// Close an open object to release memory.
|
||||
///
|
||||
/// This method instructs the library to close an existing object; note that git_objects
|
||||
/// are owned and cached by the repository so the object may or may not be freed after
|
||||
/// this library call, depending on how aggressive is the caching mechanism used by
|
||||
/// the repository.
|
||||
/// This method instructs the library to close an existing object; note that
|
||||
/// git_objects are owned and cached by the repository so the object may or may
|
||||
/// not be freed after this library call, depending on how aggressive is the
|
||||
/// caching mechanism used by the repository.
|
||||
void free(Pointer<git_object> object) => libgit2.git_object_free(object);
|
||||
|
|
|
@ -20,11 +20,11 @@ Pointer<git_odb> create() {
|
|||
|
||||
/// Add an on-disk alternate to an existing Object DB.
|
||||
///
|
||||
/// Note that the added path must point to an `objects`, not to a full repository,
|
||||
/// to use it as an alternate store.
|
||||
/// Note that the added path must point to an `objects`, not to a full
|
||||
/// repository, to use it as an alternate store.
|
||||
///
|
||||
/// Alternate backends are always checked for objects after all the main backends
|
||||
/// have been exhausted.
|
||||
/// Alternate backends are always checked for objects after all the main
|
||||
/// backends have been exhausted.
|
||||
///
|
||||
/// Writing is disabled on alternate backends.
|
||||
void addDiskAlternate({
|
||||
|
@ -36,7 +36,8 @@ void addDiskAlternate({
|
|||
calloc.free(pathC);
|
||||
}
|
||||
|
||||
/// Determine if an object can be found in the object database by an abbreviated object ID.
|
||||
/// Determine if an object can be found in the object database by an
|
||||
/// abbreviated object ID.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_oid> existsPrefix({
|
||||
|
@ -108,8 +109,8 @@ List<Oid> objects(Pointer<git_odb> odb) {
|
|||
///
|
||||
/// This method queries all available ODB backends trying to read the given OID.
|
||||
///
|
||||
/// The returned object is reference counted and internally cached, so it should be
|
||||
/// closed by the user once it's no longer in use.
|
||||
/// The returned object is reference counted and internally cached, so it
|
||||
/// should be closed by the user once it's no longer in use.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_odb_object> read({
|
||||
|
@ -141,14 +142,16 @@ int objectType(Pointer<git_odb_object> object) {
|
|||
|
||||
/// Return the data of an ODB object.
|
||||
///
|
||||
/// This is the uncompressed, raw data as read from the ODB, without the leading header.
|
||||
/// This is the uncompressed, raw data as read from the ODB, without the
|
||||
/// leading header.
|
||||
String objectData(Pointer<git_odb_object> object) {
|
||||
return libgit2.git_odb_object_data(object).cast<Utf8>().toDartString();
|
||||
}
|
||||
|
||||
/// Return the size of an ODB object.
|
||||
///
|
||||
/// This is the real size of the `data` buffer, not the actual size of the object.
|
||||
/// This is the real size of the `data` buffer, not the actual size of the
|
||||
/// object.
|
||||
int objectSize(Pointer<git_odb_object> object) {
|
||||
return libgit2.git_odb_object_size(object);
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ import 'libgit2_bindings.dart';
|
|||
|
||||
/// Directly generate a patch from the difference between two buffers.
|
||||
///
|
||||
/// You can use the standard patch accessor functions to read the patch data, and
|
||||
/// you must free the patch when done.
|
||||
/// You can use the standard patch accessor functions to read the patch data,
|
||||
/// and you must free the patch when done.
|
||||
Map<String, Pointer?> fromBuffers({
|
||||
String? oldBuffer,
|
||||
String? oldAsPath,
|
||||
|
@ -47,16 +47,16 @@ Map<String, Pointer?> fromBuffers({
|
|||
calloc.free(newAsPathC);
|
||||
calloc.free(opts);
|
||||
|
||||
// Returning map with pointers to patch and buffers because patch object does not
|
||||
// have refenrece to underlying buffers or blobs. So if the buffer or blob is freed/removed
|
||||
// Returning map with pointers to patch and buffers because patch object does
|
||||
// not have refenrece to underlying buffers or blobs. So if the buffer or blob is freed/removed
|
||||
// the patch text becomes corrupted.
|
||||
return {'patch': out.value, 'a': oldBufferC, 'b': newBufferC};
|
||||
}
|
||||
|
||||
/// Directly generate a patch from the difference between two blobs.
|
||||
///
|
||||
/// You can use the standard patch accessor functions to read the patch data, and you
|
||||
/// must free the patch when done.
|
||||
/// You can use the standard patch accessor functions to read the patch data,
|
||||
/// and you must free the patch when done.
|
||||
Map<String, Pointer?> fromBlobs({
|
||||
required Pointer<git_blob> oldBlobPointer,
|
||||
String? oldAsPath,
|
||||
|
@ -88,16 +88,16 @@ Map<String, Pointer?> fromBlobs({
|
|||
calloc.free(newAsPathC);
|
||||
calloc.free(opts);
|
||||
|
||||
// Returning map with pointers to patch and blobs because patch object does not
|
||||
// have reference to underlying blobs. So if the blob is freed/removed the patch
|
||||
// text becomes corrupted.
|
||||
// Returning map with pointers to patch and blobs because patch object does
|
||||
// not have reference to underlying blobs. So if the blob is freed/removed the
|
||||
// patch text becomes corrupted.
|
||||
return {'patch': out.value, 'a': oldBlobPointer, 'b': newBlobPointer};
|
||||
}
|
||||
|
||||
/// Directly generate a patch from the difference between a blob and a buffer.
|
||||
///
|
||||
/// You can use the standard patch accessor functions to read the patch data, and you must
|
||||
/// free the patch when done.
|
||||
/// You can use the standard patch accessor functions to read the patch data,
|
||||
/// and you must free the patch when done.
|
||||
Map<String, Pointer?> fromBlobAndBuffer({
|
||||
Pointer<git_blob>? oldBlobPointer,
|
||||
String? oldAsPath,
|
||||
|
@ -132,17 +132,17 @@ Map<String, Pointer?> fromBlobAndBuffer({
|
|||
calloc.free(bufferAsPathC);
|
||||
calloc.free(opts);
|
||||
|
||||
// Returning map with pointers to patch and buffers because patch object does not
|
||||
// have reference to underlying buffers or blobs. So if the buffer or blob is freed/removed
|
||||
// the patch text becomes corrupted.
|
||||
// Returning map with pointers to patch and buffers because patch object does
|
||||
// not have reference to underlying buffers or blobs. So if the buffer or
|
||||
// blob is freed/removed the patch text becomes corrupted.
|
||||
return {'patch': out.value, 'a': oldBlobPointer, 'b': bufferC};
|
||||
}
|
||||
|
||||
/// Return a patch for an entry in the diff list.
|
||||
///
|
||||
/// The newly created patch object contains the text diffs for the delta. You have to call
|
||||
/// `free()` when you are done with it. You can use the patch object to loop over all the
|
||||
/// hunks and lines in the diff of the one delta.
|
||||
/// The newly created patch object contains the text diffs for the delta. You
|
||||
/// have to call [free] when you are done with it. You can use the patch object
|
||||
/// to loop over all the hunks and lines in the diff of the one delta.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_patch> fromDiff({
|
||||
|
@ -169,8 +169,8 @@ int numHunks(Pointer<git_patch> patch) => libgit2.git_patch_num_hunks(patch);
|
|||
|
||||
/// Get the information about a hunk in a patch.
|
||||
///
|
||||
/// Given a patch and a hunk index into the patch, this returns detailed information
|
||||
/// about that hunk.
|
||||
/// Given a patch and a hunk index into the patch, this returns detailed
|
||||
/// information about that hunk.
|
||||
Map<String, Object> hunk({
|
||||
required Pointer<git_patch> patchPointer,
|
||||
required int hunkIndex,
|
||||
|
@ -215,12 +215,12 @@ String text(Pointer<git_patch> patch) {
|
|||
|
||||
/// Look up size of patch diff data in bytes.
|
||||
///
|
||||
/// This returns the raw size of the patch data. This only includes the actual data from
|
||||
/// the lines of the diff, not the file or hunk headers.
|
||||
/// This returns the raw size of the patch data. This only includes the actual
|
||||
/// data from the lines of the diff, not the file or hunk headers.
|
||||
///
|
||||
/// If you pass `includeContext` as true, this will be the size of all of the diff output;
|
||||
/// if you pass it as false, this will only include the actual changed lines (as if
|
||||
/// contextLines was 0).
|
||||
/// If you pass `includeContext` as true, this will be the size of all of the
|
||||
/// diff output; if you pass it as false, this will only include the actual
|
||||
/// changed lines (as if contextLines was 0).
|
||||
int size({
|
||||
required Pointer<git_patch> patchPointer,
|
||||
required bool includeContext,
|
||||
|
|
|
@ -6,16 +6,19 @@ import '../error.dart';
|
|||
import '../util.dart';
|
||||
import 'libgit2_bindings.dart';
|
||||
|
||||
/// Initializes a rebase operation to rebase the changes in [branchPointer] relative
|
||||
/// to [upstreamPointer] onto [ontoPointer] another branch. To begin the rebase process, call
|
||||
/// `next()`. When you have finished with this object, call `free()`.
|
||||
/// Initializes a rebase operation to rebase the changes in [branchPointer]
|
||||
/// relative to [upstreamPointer] onto [ontoPointer] another branch. To begin
|
||||
/// the rebase process, call [next]. When you have finished with this object,
|
||||
/// call [free].
|
||||
///
|
||||
/// [branchPointer] is the terminal commit to rebase, or null to rebase the current branch.
|
||||
/// [branchPointer] is the terminal commit to rebase, or null to rebase the
|
||||
/// current branch.
|
||||
///
|
||||
/// [upstreamPointer] is the commit to begin rebasing from, or null to rebase all
|
||||
/// reachable commits.
|
||||
/// [upstreamPointer] is the commit to begin rebasing from, or null to rebase
|
||||
/// all reachable commits.
|
||||
///
|
||||
/// [ontoPointer] is the branch to rebase onto, or null to rebase onto the given upstream.
|
||||
/// [ontoPointer] is the branch to rebase onto, or null to rebase onto the
|
||||
/// given upstream.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_rebase> init({
|
||||
|
@ -102,12 +105,13 @@ void commit({
|
|||
}
|
||||
}
|
||||
|
||||
/// Finishes a rebase that is currently in progress once all patches have been applied.
|
||||
/// Finishes a rebase that is currently in progress once all patches have been
|
||||
/// applied.
|
||||
void finish(Pointer<git_rebase> rebase) =>
|
||||
libgit2.git_rebase_finish(rebase, nullptr);
|
||||
|
||||
/// Aborts a rebase that is currently in progress, resetting the repository and working
|
||||
/// directory to their state before rebase began.
|
||||
/// Aborts a rebase that is currently in progress, resetting the repository and
|
||||
/// working directory to their state before rebase began.
|
||||
void abort(Pointer<git_rebase> rebase) => libgit2.git_rebase_abort(rebase);
|
||||
|
||||
/// Free memory allocated for rebase object.
|
||||
|
|
|
@ -14,7 +14,8 @@ int referenceType(Pointer<git_reference> ref) =>
|
|||
|
||||
/// Get the OID pointed to by a direct reference.
|
||||
///
|
||||
/// Only available if the reference is direct (i.e. an object id reference, not a symbolic one).
|
||||
/// Only available if the reference is direct (i.e. an object id reference, not
|
||||
/// a symbolic one).
|
||||
Pointer<git_oid> target(Pointer<git_reference> ref) =>
|
||||
libgit2.git_reference_target(ref);
|
||||
|
||||
|
@ -25,8 +26,8 @@ Pointer<git_oid> target(Pointer<git_reference> ref) =>
|
|||
///
|
||||
/// The peeled reference must be freed manually once it's no longer needed.
|
||||
///
|
||||
/// If a direct reference is passed as an argument, a copy of that reference is returned.
|
||||
/// This copy must be manually freed too.
|
||||
/// If a direct reference is passed as an argument, a copy of that reference is
|
||||
/// returned. This copy must be manually freed too.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_reference> resolve(Pointer<git_reference> ref) {
|
||||
|
@ -85,11 +86,11 @@ String shorthand(Pointer<git_reference> ref) {
|
|||
///
|
||||
/// The new name will be checked for validity.
|
||||
///
|
||||
/// If the force flag is not enabled, and there's already a reference with the given name,
|
||||
/// the renaming will fail.
|
||||
/// If the force flag is not enabled, and there's already a reference with the
|
||||
/// given name, the renaming will fail.
|
||||
///
|
||||
/// IMPORTANT: The user needs to write a proper reflog entry if the reflog is enabled for
|
||||
/// the repository. We only rename the reflog if it exists.
|
||||
/// IMPORTANT: The user needs to write a proper reflog entry if the reflog is
|
||||
/// enabled for the repository. We only rename the reflog if it exists.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_reference> rename({
|
||||
|
@ -179,25 +180,29 @@ bool isTag(Pointer<git_reference> ref) {
|
|||
/// Create a new direct reference.
|
||||
///
|
||||
/// A direct reference (also called an object id reference) refers directly to a
|
||||
/// specific object id (a.k.a. OID or SHA) in the repository. The id permanently refers to
|
||||
/// the object (although the reference itself can be moved). For example, in libgit2
|
||||
/// the direct ref "refs/tags/v0.17.0" refers to OID 5b9fac39d8a76b9139667c26a63e6b3f204b3977.
|
||||
/// specific object id (a.k.a. OID or SHA) in the repository. The id
|
||||
/// permanently refers to the object (although the reference itself can be
|
||||
/// moved). For example, in libgit2 the direct ref "refs/tags/v0.17.0" refers
|
||||
/// to OID 5b9fac39d8a76b9139667c26a63e6b3f204b3977.
|
||||
///
|
||||
/// The direct reference will be created in the repository and written to the disk.
|
||||
/// The generated reference object must be freed by the user.
|
||||
/// The direct reference will be created in the repository and written to the
|
||||
/// disk. The generated reference object must be freed by the user.
|
||||
///
|
||||
/// Valid reference names must follow one of two patterns:
|
||||
///
|
||||
/// Top-level names must contain only capital letters and underscores, and must begin and end
|
||||
/// with a letter. (e.g. "HEAD", "ORIG_HEAD").
|
||||
/// Names prefixed with "refs/" can be almost anything. You must avoid the characters
|
||||
/// '~', '^', ':', '\', '?', '[', and '*', and the sequences ".." and "@{" which have
|
||||
/// special meaning to revparse.
|
||||
/// This function will throw a [LibGit2Error] if a reference already exists with the given name
|
||||
/// unless force is true, in which case it will be overwritten.
|
||||
/// Top-level names must contain only capital letters and underscores, and
|
||||
/// must begin and end with a letter. (e.g. "HEAD", "ORIG_HEAD").
|
||||
/// Names prefixed with "refs/" can be almost anything. You must avoid the
|
||||
/// characters '~', '^', ':', '\', '?', '[', and '*', and the sequences ".."
|
||||
/// and "@{" which have special meaning to revparse.
|
||||
///
|
||||
/// The message for the reflog will be ignored if the reference does not belong in the
|
||||
/// standard set (HEAD, branches and remote-tracking branches) and it does not have a reflog.
|
||||
/// This function will throw a [LibGit2Error] if a reference already exists
|
||||
/// with the given name unless force is true, in which case it will be
|
||||
/// overwritten.
|
||||
///
|
||||
/// The message for the reflog will be ignored if the reference does not belong
|
||||
/// in the standard set (HEAD, branches and remote-tracking branches) and it
|
||||
/// does not have a reflog.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_reference> createDirect({
|
||||
|
@ -233,26 +238,29 @@ Pointer<git_reference> createDirect({
|
|||
|
||||
/// Create a new symbolic reference.
|
||||
///
|
||||
/// A symbolic reference is a reference name that refers to another reference name.
|
||||
/// If the other name moves, the symbolic name will move, too. As a simple example,
|
||||
/// the "HEAD" reference might refer to "refs/heads/master" while on the "master" branch
|
||||
/// of a repository.
|
||||
/// A symbolic reference is a reference name that refers to another reference
|
||||
/// name. If the other name moves, the symbolic name will move, too. As a
|
||||
/// simple example, the "HEAD" reference might refer to "refs/heads/master"
|
||||
/// while on the "master" branch of a repository.
|
||||
///
|
||||
/// The symbolic reference will be created in the repository and written to the disk.
|
||||
/// The generated reference object must be freed by the user.
|
||||
/// The symbolic reference will be created in the repository and written to the
|
||||
/// disk. The generated reference object must be freed by the user.
|
||||
///
|
||||
/// Valid reference names must follow one of two patterns:
|
||||
///
|
||||
/// Top-level names must contain only capital letters and underscores, and must begin and end
|
||||
/// with a letter. (e.g. "HEAD", "ORIG_HEAD").
|
||||
/// Names prefixed with "refs/" can be almost anything. You must avoid the characters
|
||||
/// '~', '^', ':', '\', '?', '[', and '*', and the sequences ".." and "@{" which have special
|
||||
/// meaning to revparse.
|
||||
/// This function will throw an [LibGit2Error] if a reference already exists with the given
|
||||
/// name unless force is true, in which case it will be overwritten.
|
||||
/// Top-level names must contain only capital letters and underscores, and must
|
||||
/// begin and end with a letter. (e.g. "HEAD", "ORIG_HEAD").
|
||||
/// Names prefixed with "refs/" can be almost anything. You must avoid the
|
||||
/// characters '~', '^', ':', '\', '?', '[', and '*', and the sequences ".." and
|
||||
/// "@{" which have special meaning to revparse.
|
||||
///
|
||||
/// The message for the reflog will be ignored if the reference does not belong in the standard
|
||||
/// set (HEAD, branches and remote-tracking branches) and it does not have a reflog.
|
||||
/// This function will throw an [LibGit2Error] if a reference already exists
|
||||
/// with the given name unless force is true, in which case it will be
|
||||
/// overwritten.
|
||||
///
|
||||
/// The message for the reflog will be ignored if the reference does not belong
|
||||
/// in the standard set (HEAD, branches and remote-tracking branches) and it
|
||||
/// does not have a reflog.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_reference> createSymbolic({
|
||||
|
@ -291,7 +299,8 @@ Pointer<git_reference> createSymbolic({
|
|||
/// Delete an existing reference.
|
||||
///
|
||||
/// This method works for both direct and symbolic references.
|
||||
/// The reference will be immediately removed on disk but the memory will not be freed.
|
||||
/// The reference will be immediately removed on disk but the memory will not
|
||||
/// be freed.
|
||||
void delete(Pointer<git_reference> ref) => libgit2.git_reference_delete(ref);
|
||||
|
||||
/// Get the repository where a reference resides.
|
||||
|
@ -299,8 +308,9 @@ Pointer<git_repository> owner(Pointer<git_reference> ref) {
|
|||
return libgit2.git_reference_owner(ref);
|
||||
}
|
||||
|
||||
/// Conditionally create a new reference with the same name as the given reference
|
||||
/// but a different OID target. The reference must be a direct reference, otherwise this will fail.
|
||||
/// Conditionally create a new reference with the same name as the given
|
||||
/// reference but a different OID target. The reference must be a direct
|
||||
/// reference, otherwise this will fail.
|
||||
///
|
||||
/// The new reference will be written to disk, overwriting the given reference.
|
||||
///
|
||||
|
@ -329,15 +339,17 @@ Pointer<git_reference> setTarget({
|
|||
}
|
||||
}
|
||||
|
||||
/// Create a new reference with the same name as the given reference but a different
|
||||
/// symbolic target. The reference must be a symbolic reference, otherwise this will fail.
|
||||
/// Create a new reference with the same name as the given reference but a
|
||||
/// different symbolic target. The reference must be a symbolic reference,
|
||||
/// otherwise this will fail.
|
||||
///
|
||||
/// The new reference will be written to disk, overwriting the given reference.
|
||||
///
|
||||
/// The target name will be checked for validity.
|
||||
///
|
||||
/// The message for the reflog will be ignored if the reference does not belong in the
|
||||
/// standard set (HEAD, branches and remote-tracking branches) and and it does not have a reflog.
|
||||
/// The message for the reflog will be ignored if the reference does not belong
|
||||
/// in the standard set (HEAD, branches and remote-tracking branches) and and
|
||||
/// it does not have a reflog.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_reference> setTargetSymbolic({
|
||||
|
@ -378,10 +390,11 @@ bool compare({
|
|||
|
||||
/// Recursively peel reference until object of the specified type is found.
|
||||
///
|
||||
/// The retrieved peeled object is owned by the repository and should be closed to release memory.
|
||||
/// The retrieved peeled object is owned by the repository and should be closed
|
||||
/// to release memory.
|
||||
///
|
||||
/// If you pass GIT_OBJECT_ANY as the target type, then the object will be peeled until a
|
||||
/// non-tag object is met.
|
||||
/// If you pass GIT_OBJECT_ANY as the target type, then the object will be
|
||||
/// peeled until a non-tag object is met.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_object> peel({
|
||||
|
|
|
@ -79,7 +79,8 @@ String transform({
|
|||
}
|
||||
}
|
||||
|
||||
/// Transform a target reference to its source reference following the refspec's rules.
|
||||
/// Transform a target reference to its source reference following the
|
||||
/// refspec's rules.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
String rTransform({
|
||||
|
|
|
@ -47,7 +47,8 @@ Pointer<git_remote> lookup({
|
|||
}
|
||||
}
|
||||
|
||||
/// Add a remote with the default fetch refspec to the repository's configuration.
|
||||
/// Add a remote with the default fetch refspec to the repository's
|
||||
/// configuration.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_remote> create({
|
||||
|
@ -71,7 +72,8 @@ Pointer<git_remote> create({
|
|||
}
|
||||
}
|
||||
|
||||
/// Add a remote with the provided fetch refspec to the repository's configuration.
|
||||
/// Add a remote with the provided fetch refspec to the repository's
|
||||
/// configuration.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_remote> createWithFetchSpec({
|
||||
|
@ -106,7 +108,8 @@ Pointer<git_remote> createWithFetchSpec({
|
|||
|
||||
/// Delete an existing persisted remote.
|
||||
///
|
||||
/// All remote-tracking branches and configuration settings for the remote will be removed.
|
||||
/// All remote-tracking branches and configuration settings for the remote will
|
||||
/// be removed.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void delete({
|
||||
|
@ -127,12 +130,13 @@ void delete({
|
|||
///
|
||||
/// Returns list of non-default refspecs that cannot be renamed.
|
||||
///
|
||||
/// All remote-tracking branches and configuration settings for the remote are updated.
|
||||
/// All remote-tracking branches and configuration settings for the remote are
|
||||
/// updated.
|
||||
///
|
||||
/// The new name will be checked for validity.
|
||||
///
|
||||
/// No loaded instances of a the remote with the old name will change their name or
|
||||
/// their list of refspecs.
|
||||
/// No loaded instances of a the remote with the old name will change their
|
||||
/// name or their list of refspecs.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
List<String> rename({
|
||||
|
@ -163,8 +167,8 @@ List<String> rename({
|
|||
|
||||
/// Set the remote's url in the configuration.
|
||||
///
|
||||
/// Remote objects already in memory will not be affected. This assumes the common
|
||||
/// case of a single-url remote and will otherwise return an error.
|
||||
/// Remote objects already in memory will not be affected. This assumes the
|
||||
/// common case of a single-url remote and will otherwise return an error.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void setUrl({
|
||||
|
@ -186,8 +190,8 @@ void setUrl({
|
|||
|
||||
/// Set the remote's url for pushing in the configuration.
|
||||
///
|
||||
/// Remote objects already in memory will not be affected. This assumes the common
|
||||
/// case of a single-url remote and will otherwise return an error.
|
||||
/// Remote objects already in memory will not be affected. This assumes the
|
||||
/// common case of a single-url remote and will otherwise return an error.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void setPushUrl({
|
||||
|
@ -266,8 +270,8 @@ List<String> pushRefspecs(Pointer<git_remote> remote) {
|
|||
|
||||
/// Add a fetch refspec to the remote's configuration.
|
||||
///
|
||||
/// Add the given refspec to the fetch list in the configuration. No loaded remote
|
||||
/// instances will be affected.
|
||||
/// Add the given refspec to the fetch list in the configuration. No loaded
|
||||
/// remote instances will be affected.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void addFetch({
|
||||
|
@ -289,8 +293,8 @@ void addFetch({
|
|||
|
||||
/// Add a push refspec to the remote's configuration.
|
||||
///
|
||||
/// Add the given refspec to the push list in the configuration. No loaded remote
|
||||
/// instances will be affected.
|
||||
/// Add the given refspec to the push list in the configuration. No loaded
|
||||
/// remote instances will be affected.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void addPush({
|
||||
|
@ -312,9 +316,9 @@ void addPush({
|
|||
|
||||
/// Open a connection to a remote.
|
||||
///
|
||||
/// The transport is selected based on the URL. The direction argument is due to a
|
||||
/// limitation of the git protocol (over TCP or SSH) which starts up a specific binary
|
||||
/// which can only do the one or the other.
|
||||
/// The transport is selected based on the URL. The direction argument is due
|
||||
/// to a limitation of the git protocol (over TCP or SSH) which starts up a
|
||||
/// specific binary which can only do the one or the other.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void connect({
|
||||
|
@ -355,11 +359,12 @@ void connect({
|
|||
|
||||
/// Get the remote repository's reference advertisement list.
|
||||
///
|
||||
/// Get the list of references with which the server responds to a new connection.
|
||||
/// Get the list of references with which the server responds to a new
|
||||
/// connection.
|
||||
///
|
||||
/// The remote (or more exactly its transport) must have connected to the remote repository.
|
||||
/// This list is available as soon as the connection to the remote is initiated and it
|
||||
/// remains available after disconnecting.
|
||||
/// The remote (or more exactly its transport) must have connected to the
|
||||
/// remote repository. This list is available as soon as the connection to the
|
||||
/// remote is initiated and it remains available after disconnecting.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
List<Map<String, Object?>> lsRemotes(Pointer<git_remote> remote) {
|
||||
|
@ -395,8 +400,8 @@ List<Map<String, Object?>> lsRemotes(Pointer<git_remote> remote) {
|
|||
|
||||
/// Download new data and update tips.
|
||||
///
|
||||
/// Convenience function to connect to a remote, download the data, disconnect and
|
||||
/// update the remote-tracking branches.
|
||||
/// Convenience function to connect to a remote, download the data, disconnect
|
||||
/// and update the remote-tracking branches.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void fetch({
|
||||
|
|
|
@ -16,8 +16,8 @@ class RemoteCallbacks {
|
|||
/// Callback function that reports transfer progress.
|
||||
static void Function(TransferProgress)? transferProgress;
|
||||
|
||||
/// A callback that will be regularly called with the current count of progress
|
||||
/// done by the indexer during the download of new data.
|
||||
/// A callback that will be regularly called with the current count of
|
||||
/// progress done by the indexer during the download of new data.
|
||||
static int transferProgressCb(
|
||||
Pointer<git_indexer_progress> stats,
|
||||
Pointer<Void> payload,
|
||||
|
@ -70,12 +70,14 @@ class RemoteCallbacks {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/// A function matching the `Remote Function(Repository repo, String name, String url)` signature
|
||||
/// to override the remote creation and customization process during a clone operation.
|
||||
/// A function matching the
|
||||
/// `Remote Function(Repository repo, String name, String url)` signature to
|
||||
/// override the remote creation and customization process during a clone
|
||||
/// operation.
|
||||
static Remote Function(Repository, String, String)? remoteFunction;
|
||||
|
||||
/// A callback used to create the git remote, prior to its being used to perform
|
||||
/// the clone operation.
|
||||
/// A callback used to create the git remote, prior to its being used to
|
||||
/// perform the clone operation.
|
||||
static int remoteCb(
|
||||
Pointer<Pointer<git_remote>> remote,
|
||||
Pointer<git_repository> repo,
|
||||
|
@ -92,8 +94,9 @@ class RemoteCallbacks {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/// A function matching the `Repository Function(String path, bool bare)` signature to override
|
||||
/// the repository creation and customization process during a clone operation.
|
||||
/// A function matching the `Repository Function(String path, bool bare)`
|
||||
/// signature to override the repository creation and customization process
|
||||
/// during a clone operation.
|
||||
static Repository Function(String, bool)? repositoryFunction;
|
||||
|
||||
/// A callback used to create the new repository into which to clone.
|
||||
|
@ -111,11 +114,12 @@ class RemoteCallbacks {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/// [Credentials] object used for authentication in order to connect to remote.
|
||||
/// [Credentials] object used for authentication in order to connect to
|
||||
/// remote.
|
||||
static Credentials? credentials;
|
||||
|
||||
/// Credential acquisition callback that will be called if the remote host requires
|
||||
/// authentication in order to connect to it.
|
||||
/// Credential acquisition callback that will be called if the remote host
|
||||
/// requires authentication in order to connect to it.
|
||||
static int credentialsCb(
|
||||
Pointer<Pointer<git_credential>> credPointer,
|
||||
Pointer<Int8> url,
|
||||
|
|
|
@ -30,11 +30,13 @@ Pointer<git_repository> open(String path) {
|
|||
}
|
||||
}
|
||||
|
||||
/// Look for a git repository and return its path. The lookup start from [startPath]
|
||||
/// and walk across parent directories if nothing has been found. The lookup ends when
|
||||
/// the first repository is found, or when reaching a directory referenced in [ceilingDirs].
|
||||
/// Look for a git repository and return its path. The lookup start from
|
||||
/// [startPath] and walk across parent directories if nothing has been found.
|
||||
/// The lookup ends when the first repository is found, or when reaching a
|
||||
/// directory referenced in [ceilingDirs].
|
||||
///
|
||||
/// The method will automatically detect if the repository is bare (if there is a repository).
|
||||
/// The method will automatically detect if the repository is bare (if there is
|
||||
/// a repository).
|
||||
String discover({
|
||||
required String startPath,
|
||||
String? ceilingDirs,
|
||||
|
@ -201,10 +203,11 @@ String getNamespace(Pointer<git_repository> repo) {
|
|||
|
||||
/// Sets the active namespace for this repository.
|
||||
///
|
||||
/// This namespace affects all reference operations for the repo. See `man gitnamespaces`
|
||||
/// This namespace affects all reference operations for the repo. See
|
||||
/// `man gitnamespaces`.
|
||||
///
|
||||
/// The [namespace] should not include the refs folder, e.g. to namespace all references
|
||||
/// under refs/namespaces/foo/, use foo as the namespace.
|
||||
/// The [namespace] should not include the refs folder, e.g. to namespace all
|
||||
/// references under refs/namespaces/foo/, use foo as the namespace.
|
||||
void setNamespace({
|
||||
required Pointer<git_repository> repoPointer,
|
||||
String? namespace,
|
||||
|
@ -255,7 +258,8 @@ Pointer<git_reference> head(Pointer<git_repository> repo) {
|
|||
|
||||
/// Check if a repository's HEAD is detached.
|
||||
///
|
||||
/// A repository's HEAD is detached when it points directly to a commit instead of a branch.
|
||||
/// A repository's HEAD is detached when it points directly to a commit instead
|
||||
/// of a branch.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
bool isHeadDetached(Pointer<git_repository> repo) {
|
||||
|
@ -270,8 +274,8 @@ bool isHeadDetached(Pointer<git_repository> repo) {
|
|||
|
||||
/// Check if the current branch is unborn.
|
||||
///
|
||||
/// An unborn branch is one named from HEAD but which doesn't exist in the refs namespace,
|
||||
/// because it doesn't have any commit to point to.
|
||||
/// An unborn branch is one named from HEAD but which doesn't exist in the refs
|
||||
/// namespace, because it doesn't have any commit to point to.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
bool isBranchUnborn(Pointer<git_repository> repo) {
|
||||
|
@ -287,7 +291,8 @@ bool isBranchUnborn(Pointer<git_repository> repo) {
|
|||
/// Set the identity to be used for writing reflogs.
|
||||
///
|
||||
/// If both are set, this name and email will be used to write to the reflog.
|
||||
/// Pass NULL to unset. When unset, the identity will be taken from the repository's configuration.
|
||||
/// Pass NULL to unset. When unset, the identity will be taken from the
|
||||
/// repository's configuration.
|
||||
void setIdentity({
|
||||
required Pointer<git_repository> repoPointer,
|
||||
String? name,
|
||||
|
@ -324,10 +329,12 @@ Map<String, String> identity(Pointer<git_repository> repo) {
|
|||
|
||||
/// Get the configuration file for this repository.
|
||||
///
|
||||
/// If a configuration file has not been set, the default config set for the repository
|
||||
/// will be returned, including global and system configurations (if they are available).
|
||||
/// If a configuration file has not been set, the default config set for the
|
||||
/// repository will be returned, including global and system configurations (if
|
||||
/// they are available).
|
||||
///
|
||||
/// The configuration file must be freed once it's no longer being used by the user.
|
||||
/// The configuration file must be freed once it's no longer being used by the
|
||||
/// user.
|
||||
Pointer<git_config> config(Pointer<git_repository> repo) {
|
||||
final out = calloc<Pointer<git_config>>();
|
||||
libgit2.git_repository_config(out, repo);
|
||||
|
@ -337,9 +344,11 @@ Pointer<git_config> config(Pointer<git_repository> repo) {
|
|||
/// Get a snapshot of the repository's configuration.
|
||||
///
|
||||
/// Convenience function to take a snapshot from the repository's configuration.
|
||||
/// The contents of this snapshot will not change, even if the underlying config files are modified.
|
||||
/// The contents of this snapshot will not change, even if the underlying
|
||||
/// config files are modified.
|
||||
///
|
||||
/// The configuration file must be freed once it's no longer being used by the user.
|
||||
/// The configuration file must be freed once it's no longer being used by the
|
||||
/// user.
|
||||
Pointer<git_config> configSnapshot(Pointer<git_repository> repo) {
|
||||
final out = calloc<Pointer<git_config>>();
|
||||
libgit2.git_repository_config_snapshot(out, repo);
|
||||
|
@ -376,7 +385,8 @@ bool isWorktree(Pointer<git_repository> repo) {
|
|||
/// can present it to the user for them to amend if they wish.
|
||||
///
|
||||
/// Use this function to get the contents of this file.
|
||||
/// Don't forget to remove the file with [removeMessage] after you create the commit.
|
||||
/// Don't forget to remove the file with [removeMessage] after you create the
|
||||
/// commit.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
String message(Pointer<git_repository> repo) {
|
||||
|
@ -443,10 +453,11 @@ Pointer<git_refdb> refdb(Pointer<git_repository> repo) {
|
|||
///
|
||||
/// If the provided reference points to a Tree or a Blob, the HEAD is unaltered.
|
||||
///
|
||||
/// If the provided reference points to a branch, the HEAD will point to that branch,
|
||||
/// staying attached, or become attached if it isn't yet.
|
||||
/// If the provided reference points to a branch, the HEAD will point to that
|
||||
/// branch, staying attached, or become attached if it isn't yet.
|
||||
///
|
||||
/// If the branch doesn't exist yet, the HEAD will be attached to an unborn branch.
|
||||
/// If the branch doesn't exist yet, the HEAD will be attached to an unborn
|
||||
/// branch.
|
||||
///
|
||||
/// Otherwise, the HEAD will be detached and will directly point to the Commit.
|
||||
///
|
||||
|
@ -467,11 +478,14 @@ void setHead({
|
|||
|
||||
/// Make the repository HEAD directly point to the commit.
|
||||
///
|
||||
/// If the provided committish cannot be found in the repository, the HEAD is unaltered.
|
||||
/// If the provided committish cannot be found in the repository, the HEAD is
|
||||
/// unaltered.
|
||||
///
|
||||
/// If the provided commitish cannot be peeled into a commit, the HEAD is unaltered.
|
||||
/// If the provided commitish cannot be peeled into a commit, the HEAD is
|
||||
/// unaltered.
|
||||
///
|
||||
/// Otherwise, the HEAD will eventually be detached and will directly point to the peeled commit.
|
||||
/// Otherwise, the HEAD will eventually be detached and will directly point to
|
||||
/// the peeled commit.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void setHeadDetached({
|
||||
|
@ -493,8 +507,8 @@ void setHeadDetached({
|
|||
/// 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
|
||||
/// 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.
|
||||
|
|
|
@ -3,16 +3,17 @@ import 'dart:ffi';
|
|||
import '../util.dart';
|
||||
import 'libgit2_bindings.dart';
|
||||
|
||||
/// Sets the current head to the specified commit oid and optionally resets the index
|
||||
/// and working tree to match.
|
||||
/// Sets the current head to the specified commit oid and optionally resets the
|
||||
/// index and working tree to match.
|
||||
///
|
||||
/// SOFT reset means the Head will be moved to the commit.
|
||||
///
|
||||
/// MIXED reset will trigger a SOFT reset, plus the index will be replaced with the
|
||||
/// content of the commit tree.
|
||||
/// MIXED reset will trigger a SOFT reset, plus the index will be replaced with
|
||||
/// the content of the commit tree.
|
||||
///
|
||||
/// HARD reset will trigger a MIXED reset and the working directory will be replaced
|
||||
/// with the content of the index. (Untracked and ignored files will be left alone, however.)
|
||||
/// HARD reset will trigger a MIXED reset and the working directory will be
|
||||
/// replaced with the content of the index. (Untracked and ignored files will
|
||||
/// be left alone, however.)
|
||||
void reset({
|
||||
required Pointer<git_repository> repoPointer,
|
||||
required Pointer<git_object> targetPointer,
|
||||
|
|
|
@ -62,9 +62,9 @@ Pointer<git_object> revParseSingle({
|
|||
/// See `man gitrevisions`, or https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions
|
||||
/// for information on the syntax accepted.
|
||||
///
|
||||
/// In some cases (@{<-n>} or <branchname>@{upstream}), the expression may point to an
|
||||
/// intermediate reference. When such expressions are being passed in, reference_out will be
|
||||
/// valued as well.
|
||||
/// In some cases (@{<-n>} or <branchname>@{upstream}), the expression may
|
||||
/// point to an intermediate reference. When such expressions are being passed
|
||||
/// in, reference_out will be valued as well.
|
||||
///
|
||||
/// The returned object and reference should be released when no longer needed.
|
||||
///
|
||||
|
|
|
@ -12,11 +12,12 @@ import 'libgit2_bindings.dart';
|
|||
/// This revision walker uses a custom memory pool and an internal commit cache,
|
||||
/// so it is relatively expensive to allocate.
|
||||
///
|
||||
/// For maximum performance, this revision walker should be reused for different walks.
|
||||
/// For maximum performance, this revision walker should be reused for
|
||||
/// different walks.
|
||||
///
|
||||
/// This revision walker is not thread safe: it may only be used to walk a repository
|
||||
/// on a single thread; however, it is possible to have several revision walkers in several
|
||||
/// different threads walking the same repository.
|
||||
/// This revision walker is not thread safe: it may only be used to walk a
|
||||
/// repository on a single thread; however, it is possible to have several
|
||||
/// revision walkers in several different threads walking the same repository.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_revwalk> create(Pointer<git_repository> repo) {
|
||||
|
@ -43,10 +44,11 @@ void sorting({
|
|||
|
||||
/// Add a new root for the traversal.
|
||||
///
|
||||
/// The pushed commit will be marked as one of the roots from which to start the walk.
|
||||
/// This commit may not be walked if it or a child is hidden.
|
||||
/// The pushed commit will be marked as one of the roots from which to start
|
||||
/// the walk. This commit may not be walked if it or a child is hidden.
|
||||
///
|
||||
/// At least one commit must be pushed onto the walker before a walk can be started.
|
||||
/// At least one commit must be pushed onto the walker before a walk can be
|
||||
/// started.
|
||||
///
|
||||
/// The given id must belong to a committish on the walked repository.
|
||||
///
|
||||
|
@ -64,12 +66,13 @@ void push({
|
|||
|
||||
/// Get the list of commits from the revision walk.
|
||||
///
|
||||
/// The initial call to this method is not blocking when iterating through a repo
|
||||
/// with a time-sorting mode.
|
||||
/// The initial call to this method is not blocking when iterating through a
|
||||
/// repo with a time-sorting mode.
|
||||
///
|
||||
/// Iterating with Topological or inverted modes makes the initial call blocking to
|
||||
/// preprocess the commit list, but this block should be mostly unnoticeable on most
|
||||
/// repositories (topological preprocessing times at 0.3s on the git.git repo).
|
||||
/// Iterating with Topological or inverted modes makes the initial call
|
||||
/// blocking to preprocess the commit list, but this block should be mostly
|
||||
/// unnoticeable on most repositories (topological preprocessing times at 0.3s
|
||||
/// on the git.git repo).
|
||||
///
|
||||
/// The revision walker is reset when the walk is over.
|
||||
List<Pointer<git_commit>> walk({
|
||||
|
@ -101,7 +104,8 @@ List<Pointer<git_commit>> walk({
|
|||
///
|
||||
/// The given id must belong to a committish on the walked repository.
|
||||
///
|
||||
/// The resolved commit and all its parents will be hidden from the output on the revision walk.
|
||||
/// The resolved commit and all its parents will be hidden from the output on
|
||||
/// the revision walk.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void hide({
|
||||
|
@ -117,8 +121,9 @@ void hide({
|
|||
|
||||
/// Reset the revision walker for reuse.
|
||||
///
|
||||
/// This will clear all the pushed and hidden commits, and leave the walker in a blank state
|
||||
/// (just like at creation) ready to receive new commit pushes and start a new walk.
|
||||
/// This will clear all the pushed and hidden commits, and leave the walker in
|
||||
/// a blank state (just like at creation) ready to receive new commit pushes
|
||||
/// and start a new walk.
|
||||
///
|
||||
/// The revision walk is automatically reset when a walk is over.
|
||||
void reset(Pointer<git_revwalk> walker) => libgit2.git_revwalk_reset(walker);
|
||||
|
|
|
@ -56,8 +56,9 @@ Pointer<git_signature> now({required String name, required String email}) {
|
|||
|
||||
/// Create a new action signature with default user and now timestamp.
|
||||
///
|
||||
/// This looks up the user.name and user.email from the configuration and uses the
|
||||
/// current time as the timestamp, and creates a new signature based on that information.
|
||||
/// This looks up the user.name and user.email from the configuration and uses
|
||||
/// the current time as the timestamp, and creates a new signature based on
|
||||
/// that information.
|
||||
Pointer<git_signature> defaultSignature(Pointer<git_repository> repo) {
|
||||
final out = calloc<Pointer<git_signature>>();
|
||||
libgit2.git_signature_default(out, repo);
|
||||
|
|
|
@ -92,7 +92,8 @@ void drop({required Pointer<git_repository> repoPointer, required int index}) {
|
|||
}
|
||||
}
|
||||
|
||||
/// Apply a single stashed state from the stash list and remove it from the list if successful.
|
||||
/// Apply a single stashed state from the stash list and remove it from the
|
||||
/// list if successful.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void pop({
|
||||
|
|
|
@ -42,17 +42,20 @@ Pointer<git_status_entry> getByIndex({
|
|||
|
||||
/// Get file status for a single file.
|
||||
///
|
||||
/// This tries to get status for the filename that you give. If no files match that name
|
||||
/// (in either the HEAD, index, or working directory), this returns GIT_ENOTFOUND.
|
||||
/// This tries to get status for the filename that you give. If no files match
|
||||
/// that name (in either the HEAD, index, or working directory), this returns
|
||||
/// GIT_ENOTFOUND.
|
||||
///
|
||||
/// If the name matches multiple files (for example, if the path names a directory or if
|
||||
/// running on a case- insensitive filesystem and yet the HEAD has two entries that both
|
||||
/// match the path), then this returns GIT_EAMBIGUOUS because it cannot give correct results.
|
||||
/// If the name matches multiple files (for example, if the path names a
|
||||
/// directory or if running on a case- insensitive filesystem and yet the HEAD
|
||||
/// has two entries that both match the path), then this returns GIT_EAMBIGUOUS
|
||||
/// because it cannot give correct results.
|
||||
///
|
||||
/// This does not do any sort of rename detection. Renames require a set of targets and because
|
||||
/// of the path filtering, there is not enough information to check renames correctly. To check
|
||||
/// file status with rename detection, there is no choice but to do a full listNew
|
||||
/// and scan through looking for the path that you are interested in.
|
||||
/// This does not do any sort of rename detection. Renames require a set of
|
||||
/// targets and because of the path filtering, there is not enough information
|
||||
/// to check renames correctly. To check file status with rename detection,
|
||||
/// there is no choice but to do a full listNew and scan through looking for
|
||||
/// the path that you are interested in.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
int file({required Pointer<git_repository> repoPointer, required String path}) {
|
||||
|
|
|
@ -69,8 +69,8 @@ Pointer<git_submodule> lookup({
|
|||
/// Just like `git submodule init`, this copies information about the
|
||||
/// submodule into `.git/config`.
|
||||
///
|
||||
/// By default, existing entries will not be overwritten, but setting [overwrite]
|
||||
/// to true forces them to be updated.
|
||||
/// By default, existing entries will not be overwritten, but setting
|
||||
/// [overwrite] to true forces them to be updated.
|
||||
void init({
|
||||
required Pointer<git_submodule> submodulePointer,
|
||||
bool overwrite = false,
|
||||
|
@ -80,14 +80,14 @@ void init({
|
|||
}
|
||||
|
||||
/// Update a submodule. This will clone a missing submodule and checkout the
|
||||
/// subrepository to the commit specified in the index of the containing repository.
|
||||
/// If the submodule repository doesn't contain the target commit (e.g. because
|
||||
/// fetchRecurseSubmodules isn't set), then the submodule is fetched using the fetch
|
||||
/// options supplied in [callbacks].
|
||||
/// subrepository to the commit specified in the index of the containing
|
||||
/// repository. If the submodule repository doesn't contain the target commit
|
||||
/// (e.g. because fetchRecurseSubmodules isn't set), then the submodule is
|
||||
/// fetched using the fetch options supplied in [callbacks].
|
||||
///
|
||||
/// If the submodule is not initialized, setting [init] to true will initialize the
|
||||
/// submodule before updating. Otherwise, this will return an error if attempting
|
||||
/// to update an uninitialzed repository.
|
||||
/// If the submodule is not initialized, setting [init] to true will initialize
|
||||
/// the submodule before updating. Otherwise, this will return an error if
|
||||
/// attempting to update an uninitialzed repository.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void update({
|
||||
|
@ -119,10 +119,10 @@ void update({
|
|||
|
||||
/// Open the repository for a submodule.
|
||||
///
|
||||
/// This is a newly opened repository object. The caller is responsible for calling
|
||||
/// `free()` on it when done. Multiple calls to this function will return distinct
|
||||
/// git repository objects. This will only work if the submodule is checked out into
|
||||
/// the working directory.
|
||||
/// This is a newly opened repository object. The caller is responsible for
|
||||
/// calling free on it when done. Multiple calls to this function will return
|
||||
/// distinct git repository objects. This will only work if the submodule is
|
||||
/// checked out into the working directory.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_repository> open(Pointer<git_submodule> submodule) {
|
||||
|
@ -139,10 +139,11 @@ Pointer<git_repository> open(Pointer<git_submodule> submodule) {
|
|||
|
||||
/// Set up a new git submodule for checkout.
|
||||
///
|
||||
/// This does `git submodule add` up to the fetch and checkout of the submodule contents.
|
||||
/// It preps a new submodule, creates an entry in `.gitmodules` and creates an empty
|
||||
/// initialized repository either at the given path in the working directory or in
|
||||
/// `.git/modules` with a gitlink from the working directory to the new repo.
|
||||
/// This does `git submodule add` up to the fetch and checkout of the submodule
|
||||
/// contents. It preps a new submodule, creates an entry in `.gitmodules` and
|
||||
/// creates an empty initialized repository either at the given path in the
|
||||
/// working directory or in `.git/modules` with a gitlink from the working
|
||||
/// directory to the new repo.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_submodule> addSetup({
|
||||
|
@ -208,16 +209,16 @@ void clone({
|
|||
///
|
||||
/// This should be called on a submodule once you have called add setup and done
|
||||
/// the clone of the submodule. This adds the `.gitmodules` file and the newly
|
||||
/// cloned submodule to the index to be ready to be committed (but doesn't actually
|
||||
/// do the commit).
|
||||
/// cloned submodule to the index to be ready to be committed (but doesn't
|
||||
/// actually do the commit).
|
||||
void addFinalize(Pointer<git_submodule> submodule) {
|
||||
libgit2.git_submodule_add_finalize(submodule);
|
||||
}
|
||||
|
||||
/// Get the status for a submodule.
|
||||
///
|
||||
/// This looks at a submodule and tries to determine the status. How deeply it examines
|
||||
/// the working directory to do this will depend on the [ignore] value.
|
||||
/// This looks at a submodule and tries to determine the status. How deeply it
|
||||
/// examines the working directory to do this will depend on the [ignore] value.
|
||||
int status({
|
||||
required Pointer<git_repository> repoPointer,
|
||||
required String name,
|
||||
|
@ -236,17 +237,17 @@ int status({
|
|||
|
||||
/// Copy submodule remote info into submodule repo.
|
||||
///
|
||||
/// This copies the information about the submodules URL into the checked out submodule
|
||||
/// config, acting like `git submodule sync`. This is useful if you have altered the URL
|
||||
/// for the submodule (or it has been altered by a fetch of upstream changes) and you
|
||||
/// need to update your local repo.
|
||||
/// This copies the information about the submodules URL into the checked out
|
||||
/// submodule config, acting like `git submodule sync`. This is useful if you
|
||||
/// have altered the URL for the submodule (or it has been altered by a fetch
|
||||
/// of upstream changes) and you need to update your local repo.
|
||||
void sync(Pointer<git_submodule> submodule) =>
|
||||
libgit2.git_submodule_sync(submodule);
|
||||
|
||||
/// Reread submodule info from config, index, and HEAD.
|
||||
///
|
||||
/// Call this to reread cached submodule information for this submodule if you have
|
||||
/// reason to believe that it has changed.
|
||||
/// Call this to reread cached submodule information for this submodule if you
|
||||
/// have reason to believe that it has changed.
|
||||
///
|
||||
/// Set [force] to true to reload even if the data doesn't seem out of date.
|
||||
void reload({
|
||||
|
@ -335,10 +336,10 @@ Pointer<git_oid>? indexId(Pointer<git_submodule> submodule) {
|
|||
|
||||
/// Get the OID for the submodule in the current working directory.
|
||||
///
|
||||
/// This returns the OID that corresponds to looking up `HEAD` in the checked out
|
||||
/// submodule. If there are pending changes in the index or anything else, this
|
||||
/// won't notice that. You should call [status] for a more complete picture about
|
||||
/// the state of the working directory.
|
||||
/// This returns the OID that corresponds to looking up `HEAD` in the checked
|
||||
/// out submodule. If there are pending changes in the index or anything else,
|
||||
/// this won't notice that. You should call [status] for a more complete
|
||||
/// picture about the state of the working directory.
|
||||
///
|
||||
/// Returns null if submodule is not checked out.
|
||||
Pointer<git_oid>? workdirId(Pointer<git_submodule> submodule) {
|
||||
|
@ -388,8 +389,8 @@ void setUpdateRule({
|
|||
///
|
||||
/// This returns a pointer to the repository that contains the submodule.
|
||||
/// This is a just a reference to the repository that was passed to the original
|
||||
/// [lookup] call, so if that repository has been freed, then this may be a dangling
|
||||
/// reference.
|
||||
/// [lookup] call, so if that repository has been freed, then this may be a
|
||||
/// dangling reference.
|
||||
Pointer<git_repository> owner(Pointer<git_submodule> submodule) {
|
||||
return libgit2.git_submodule_owner(submodule);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,8 @@ Pointer<git_tag> lookup({
|
|||
|
||||
/// Get the tagged object of a tag.
|
||||
///
|
||||
/// This method performs a repository lookup for the given object and returns it.
|
||||
/// This method performs a repository lookup for the given object and returns
|
||||
/// it.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_object> target(Pointer<git_tag> tag) {
|
||||
|
@ -82,8 +83,9 @@ Pointer<git_signature> tagger(Pointer<git_tag> tag) =>
|
|||
|
||||
/// Create a new tag in the repository from an object.
|
||||
///
|
||||
/// A new reference will also be created pointing to this tag object. If force is true
|
||||
/// and a reference already exists with the given name, it'll be replaced.
|
||||
/// A new reference will also be created pointing to this tag object. If force
|
||||
/// is true and a reference already exists with the given name, it'll be
|
||||
/// replaced.
|
||||
///
|
||||
/// The message will not be cleaned up.
|
||||
///
|
||||
|
|
|
@ -33,8 +33,8 @@ Pointer<git_repository> owner(Pointer<git_tree> tree) =>
|
|||
|
||||
/// Lookup a tree entry by its position in the tree.
|
||||
///
|
||||
/// This returns a tree entry that is owned by the tree. You don't have to free it,
|
||||
/// but you must not use it after the tree is released.
|
||||
/// This returns a tree entry that is owned by the tree. You don't have to free
|
||||
/// it, but you must not use it after the tree is released.
|
||||
///
|
||||
/// Throws [RangeError] when provided index is outside of valid range.
|
||||
Pointer<git_tree_entry> getByIndex({
|
||||
|
@ -52,8 +52,8 @@ Pointer<git_tree_entry> getByIndex({
|
|||
|
||||
/// Lookup a tree entry by its filename.
|
||||
///
|
||||
/// This returns a tree entry that is owned by the tree. You don't have to free it,
|
||||
/// but you must not use it after the tree is released.
|
||||
/// This returns a tree entry that is owned by the tree. You don't have to free
|
||||
/// it, but you must not use it after the tree is released.
|
||||
///
|
||||
/// Throws [ArgumentError] if nothing found for provided filename.
|
||||
Pointer<git_tree_entry> getByName({
|
||||
|
@ -72,10 +72,11 @@ Pointer<git_tree_entry> getByName({
|
|||
}
|
||||
}
|
||||
|
||||
/// Retrieve a tree entry contained in a tree or in any of its subtrees, given its relative path.
|
||||
/// Retrieve a tree entry contained in a tree or in any of its subtrees, given
|
||||
/// its relative path.
|
||||
///
|
||||
/// Unlike the other lookup functions, the returned tree entry is owned by the user and must be
|
||||
/// freed explicitly with [entryFree].
|
||||
/// Unlike the other lookup functions, the returned tree entry is owned by the
|
||||
/// user and must be freed explicitly with [entryFree].
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_tree_entry> getByPath({
|
||||
|
|
|
@ -8,11 +8,11 @@ import 'libgit2_bindings.dart';
|
|||
|
||||
/// Create a new tree builder.
|
||||
///
|
||||
/// The tree builder can be used to create or modify trees in memory and write them
|
||||
/// as tree objects to the database.
|
||||
/// The tree builder can be used to create or modify trees in memory and write
|
||||
/// them as tree objects to the database.
|
||||
///
|
||||
/// If the source parameter is not null, the tree builder will be initialized with
|
||||
/// the entries of the given tree.
|
||||
/// If the source parameter is not null, the tree builder will be initialized
|
||||
/// with the entries of the given tree.
|
||||
///
|
||||
/// If the source parameter is null, the tree builder will start with no entries
|
||||
/// and will have to be filled manually.
|
||||
|
@ -72,8 +72,8 @@ Pointer<git_tree_entry> getByFilename({
|
|||
///
|
||||
/// Insert a new entry for filename in the builder with the given attributes.
|
||||
///
|
||||
/// If an entry named filename already exists, its attributes will be updated with
|
||||
/// the given ones.
|
||||
/// If an entry named filename already exists, its attributes will be updated
|
||||
/// with the given ones.
|
||||
///
|
||||
/// By default the entry that you are inserting will be checked for validity;
|
||||
/// that it exists in the object database and is of the correct type.
|
||||
|
|
|
@ -10,7 +10,8 @@ import 'libgit2_bindings.dart';
|
|||
/// Add a new working tree.
|
||||
///
|
||||
/// Add a new working tree for the repository, that is create the required
|
||||
/// data structures inside the repository and check out the current HEAD at path.
|
||||
/// data structures inside the repository and check out the current HEAD at
|
||||
/// path.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_worktree> create({
|
||||
|
@ -136,8 +137,8 @@ void unlock(Pointer<git_worktree> wt) => libgit2.git_worktree_unlock(wt);
|
|||
|
||||
/// Check if worktree is valid.
|
||||
///
|
||||
/// A valid worktree requires both the git data structures inside the linked parent
|
||||
/// repository and the linked working copy to be present.
|
||||
/// A valid worktree requires both the git data structures inside the linked
|
||||
/// parent repository and the linked working copy to be present.
|
||||
bool isValid(Pointer<git_worktree> wt) {
|
||||
return libgit2.git_worktree_validate(wt) == 0 ? true : false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue