152 lines
104 KiB
HTML
152 lines
104 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Base.LibGit2 · The Julia Language</title><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||
|
||
ga('create', 'UA-28835595-6', 'auto');
|
||
ga('send', 'pageview');
|
||
</script><link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.min.css" rel="stylesheet" type="text/css"/><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/><link href="../assets/julia-manual.css" rel="stylesheet" type="text/css"/></head><body><nav class="toc"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="The Julia Language logo"/></a><h1>The Julia Language</h1><select id="version-selector" onChange="window.location.href=this.value" style="visibility: hidden"></select><form class="search" id="search-form" action="../search.html"><input id="search-query" name="q" type="text" placeholder="Search docs"/></form><ul><li><a class="toctext" href="../index.html">Home</a></li><li><span class="toctext">Manual</span><ul><li><a class="toctext" href="../manual/introduction.html">Introduction</a></li><li><a class="toctext" href="../manual/getting-started.html">Getting Started</a></li><li><a class="toctext" href="../manual/variables.html">Variables</a></li><li><a class="toctext" href="../manual/integers-and-floating-point-numbers.html">Integers and Floating-Point Numbers</a></li><li><a class="toctext" href="../manual/mathematical-operations.html">Mathematical Operations and Elementary Functions</a></li><li><a class="toctext" href="../manual/complex-and-rational-numbers.html">Complex and Rational Numbers</a></li><li><a class="toctext" href="../manual/strings.html">Strings</a></li><li><a class="toctext" href="../manual/functions.html">Functions</a></li><li><a class="toctext" href="../manual/control-flow.html">Control Flow</a></li><li><a class="toctext" href="../manual/variables-and-scoping.html">Scope of Variables</a></li><li><a class="toctext" href="../manual/types.html">Types</a></li><li><a class="toctext" href="../manual/methods.html">Methods</a></li><li><a class="toctext" href="../manual/constructors.html">Constructors</a></li><li><a class="toctext" href="../manual/conversion-and-promotion.html">Conversion and Promotion</a></li><li><a class="toctext" href="../manual/interfaces.html">Interfaces</a></li><li><a class="toctext" href="../manual/modules.html">Modules</a></li><li><a class="toctext" href="../manual/documentation.html">Documentation</a></li><li><a class="toctext" href="../manual/metaprogramming.html">Metaprogramming</a></li><li><a class="toctext" href="../manual/arrays.html">Multi-dimensional Arrays</a></li><li><a class="toctext" href="../manual/linear-algebra.html">Linear algebra</a></li><li><a class="toctext" href="../manual/networking-and-streams.html">Networking and Streams</a></li><li><a class="toctext" href="../manual/parallel-computing.html">Parallel Computing</a></li><li><a class="toctext" href="../manual/dates.html">Date and DateTime</a></li><li><a class="toctext" href="../manual/interacting-with-julia.html">Interacting With Julia</a></li><li><a class="toctext" href="../manual/running-external-programs.html">Running External Programs</a></li><li><a class="toctext" href="../manual/calling-c-and-fortran-code.html">Calling C and Fortran Code</a></li><li><a class="toctext" href="../manual/handling-operating-system-variation.html">Handling Operating System Variation</a></li><li><a class="toctext" href="../manual/environment-variables.html">Environment Variables</a></li><li><a class="toctext" href="../manual/embedding.html">Embedding Julia</a></li><li><a class="toctext" href="../manual/packages.html">Packages</a></li><li><a class="toctext" href="../manual/profile.html">Profiling</a></li><li><a class="toctext" href="../manual/stacktraces.html">Stack Traces</a></li><li><a class="toctext" href="../manual/performance-tips.html">Performance Tips</a></li><li><a class="toctext" href="../manual/workflow-tips.html">Workflow Tips</a></li><li><a class="toctext" href="../manual/style-guide.html">Style Guide</a></li><li><a class="toctext" href="../manual/faq.html">Frequently Asked Questions</a></li><li><a class="toctext" href="../manual/noteworthy-differences.html">Noteworthy Differences from other Languages</a></li><li><a class="toctext" href="../manual/unicode-input.html">Unicode Input</a></li></ul></li><li><span class="toctext">Standard Library</span><ul><li><a class="toctext" href="../stdlib/base.html">Essentials</a></li><li><a class="toctext" href="../stdlib/collections.html">Collections and Data Structures</a></li><li><a class="toctext" href="../stdlib/math.html">Mathematics</a></li><li><a class="toctext" href="../stdlib/numbers.html">Numbers</a></li><li><a class="toctext" href="../stdlib/strings.html">Strings</a></li><li><a class="toctext" href="../stdlib/arrays.html">Arrays</a></li><li><a class="toctext" href="../stdlib/parallel.html">Tasks and Parallel Computing</a></li><li><a class="toctext" href="../stdlib/linalg.html">Linear Algebra</a></li><li><a class="toctext" href="../stdlib/constants.html">Constants</a></li><li><a class="toctext" href="../stdlib/file.html">Filesystem</a></li><li><a class="toctext" href="../stdlib/io-network.html">I/O and Network</a></li><li><a class="toctext" href="../stdlib/punctuation.html">Punctuation</a></li><li><a class="toctext" href="../stdlib/sort.html">Sorting and Related Functions</a></li><li><a class="toctext" href="../stdlib/pkg.html">Package Manager Functions</a></li><li><a class="toctext" href="../stdlib/dates.html">Dates and Time</a></li><li><a class="toctext" href="../stdlib/iterators.html">Iteration utilities</a></li><li><a class="toctext" href="../stdlib/test.html">Unit Testing</a></li><li><a class="toctext" href="../stdlib/c.html">C Interface</a></li><li><a class="toctext" href="../stdlib/libc.html">C Standard Library</a></li><li><a class="toctext" href="../stdlib/libdl.html">Dynamic Linker</a></li><li><a class="toctext" href="../stdlib/profile.html">Profiling</a></li><li><a class="toctext" href="../stdlib/stacktraces.html">StackTraces</a></li><li><a class="toctext" href="../stdlib/simd-types.html">SIMD Support</a></li></ul></li><li><span class="toctext">Developer Documentation</span><ul><li><a class="toctext" href="reflection.html">Reflection and introspection</a></li><li><span class="toctext">Documentation of Julia's Internals</span><ul><li><a class="toctext" href="init.html">Initialization of the Julia runtime</a></li><li><a class="toctext" href="ast.html">Julia ASTs</a></li><li><a class="toctext" href="types.html">More about types</a></li><li><a class="toctext" href="object.html">Memory layout of Julia Objects</a></li><li><a class="toctext" href="eval.html">Eval of Julia code</a></li><li><a class="toctext" href="callconv.html">Calling Conventions</a></li><li><a class="toctext" href="compiler.html">High-level Overview of the Native-Code Generation Process</a></li><li><a class="toctext" href="functions.html">Julia Functions</a></li><li><a class="toctext" href="cartesian.html">Base.Cartesian</a></li><li><a class="toctext" href="meta.html">Talking to the compiler (the <code>:meta</code> mechanism)</a></li><li><a class="toctext" href="subarrays.html">SubArrays</a></li><li><a class="toctext" href="sysimg.html">System Image Building</a></li><li><a class="toctext" href="llvm.html">Working with LLVM</a></li><li><a class="toctext" href="stdio.html">printf() and stdio in the Julia runtime</a></li><li><a class="toctext" href="boundscheck.html">Bounds checking</a></li><li><a class="toctext" href="locks.html">Proper maintenance and care of multi-threading locks</a></li><li><a class="toctext" href="offset-arrays.html">Arrays with custom indices</a></li><li class="current"><a class="toctext" href="libgit2.html">Base.LibGit2</a><ul class="internal"></ul></li><li><a class="toctext" href="require.html">Module loading</a></li></ul></li><li><span class="toctext">Developing/debugging Julia's C code</span><ul><li><a class="toctext" href="backtraces.html">Reporting and analyzing crashes (segfaults)</a></li><li><a class="toctext" href="debuggingtips.html">gdb debugging tips</a></li><li><a class="toctext" href="valgrind.html">Using Valgrind with Julia</a></li><li><a class="toctext" href="sanitizers.html">Sanitizer support</a></li></ul></li></ul></li></ul></nav><article id="docs"><header><nav><ul><li>Developer Documentation</li><li>Documentation of Julia's Internals</li><li><a href="libgit2.html">Base.LibGit2</a></li></ul><a class="edit-page" href="https://github.com/JuliaLang/julia/blob/master/doc/src/devdocs/libgit2.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>Base.LibGit2</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Base.LibGit2-1" href="#Base.LibGit2-1">Base.LibGit2</a></h1><p>The LibGit2 module provides bindings to <a href="https://libgit2.github.com/">libgit2</a>, a portable C library that implements core functionality for the <a href="https://git-scm.com/">Git</a> version control system. These bindings are currently used to power Julia's package manager. It is expected that this module will eventually be moved into a separate package.</p><h3><a class="nav-anchor" id="Functionality-1" href="#Functionality-1">Functionality</a></h3><p>Some of this documentation assumes some prior knowledge of the libgit2 API. For more information on some of the objects and methods referenced here, consult the upstream <a href="https://libgit2.github.com/libgit2/#v0.25.1">libgit2 API reference</a>.</p><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.AbstractCredentials" href="#Base.LibGit2.AbstractCredentials"><code>Base.LibGit2.AbstractCredentials</code></a> — <span class="docstring-category">Type</span>.</div><div><p>Abstract credentials payload</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L121">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.Buffer" href="#Base.LibGit2.Buffer"><code>Base.LibGit2.Buffer</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.Buffer</code></pre><p>A data buffer for exporting data from libgit2. Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_buf"><code>git_buf</code></a> struct.</p><p>When fetching data from LibGit2, a typical usage would look like:</p><pre><code class="language-julia">buf_ref = Ref(Buffer())
|
||
@check ccall(..., (Ptr{Buffer},), buf_ref)
|
||
# operation on buf_ref
|
||
free(buf_ref)</code></pre><p>In particular, note that <code>LibGit2.free</code> should be called afterward on the <code>Ref</code> object.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L95-L109">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.CachedCredentials" href="#Base.LibGit2.CachedCredentials"><code>Base.LibGit2.CachedCredentials</code></a> — <span class="docstring-category">Type</span>.</div><div><p>Credentials that support caching</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L719">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.CheckoutOptions" href="#Base.LibGit2.CheckoutOptions"><code>Base.LibGit2.CheckoutOptions</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.CheckoutOptions</code></pre><p>Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_checkout_options"><code>git_checkout_options</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L806-L810">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.CloneOptions" href="#Base.LibGit2.CloneOptions"><code>Base.LibGit2.CloneOptions</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.CloneOptions</code></pre><p>Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_clone_options"><code>git_clone_options</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L806-L810">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.DiffDelta" href="#Base.LibGit2.DiffDelta"><code>Base.LibGit2.DiffDelta</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.DiffDelta</code></pre><p>Description of changes to one entry. Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_diff_delta"><code>git_diff_delta</code></a> struct.</p><p>The fields represent:</p><ul><li><p><code>status</code>: One of <code>Consts.DELTA_STATUS</code>, indicating whether the file has been added/modified/deleted.</p></li><li><p><code>flags</code>: Flags for the delta and the objects on each side. Determines whether to treat the file(s) as binary/text, whether they exist on each side of the diff, and whether the object ids are known to be correct.</p></li><li><p><code>similarity</code>: Used to indicate if a file has been renamed or copied.</p></li><li><p><code>nfiles</code>: The number of files in the delta (for instance, if the delta was run on a submodule commit id, it may contain more than one file).</p></li><li><p><code>old_file</code>: A <a href="libgit2.html#Base.LibGit2.DiffFile"><code>DiffFile</code></a> containing information about the file(s) before the changes.</p></li><li><p><code>new_file</code>: A <a href="libgit2.html#Base.LibGit2.DiffFile"><code>DiffFile</code></a> containing information about the file(s) after the changes.</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L297-L313">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.DiffFile" href="#Base.LibGit2.DiffFile"><code>Base.LibGit2.DiffFile</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.DiffFile</code></pre><p>Description of one side of a delta. Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_diff_file"><code>git_diff_file</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L273-L278">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.DiffOptionsStruct" href="#Base.LibGit2.DiffOptionsStruct"><code>Base.LibGit2.DiffOptionsStruct</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.DiffOptionsStruct</code></pre><p>Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_diff_options"><code>git_diff_options</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L806-L810">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.FetchHead" href="#Base.LibGit2.FetchHead"><code>Base.LibGit2.FetchHead</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.FetchHead</code></pre><p>Contains the information about HEAD during a fetch, including the name and URL of the branch fetched from, the oid of the HEAD, and whether the fetched HEAD has been merged locally.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L468-L474">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.FetchOptions" href="#Base.LibGit2.FetchOptions"><code>Base.LibGit2.FetchOptions</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.FetchOptions</code></pre><p>Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_fetch_options"><code>git_fetch_options</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L806-L810">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.GitBlob" href="#Base.LibGit2.GitBlob"><code>Base.LibGit2.GitBlob</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">GitBlob(repo::GitRepo, hash::AbstractGitHash)
|
||
GitBlob(repo::GitRepo, spec::AbstractString)</code></pre><p>Return a <code>GitBlob</code> object from <code>repo</code> specified by <code>hash</code>/<code>spec</code>.</p><ul><li><p><code>hash</code> is a full (<code>GitHash</code>) or partial (<code>GitShortHash</code>) hash.</p></li><li><p><code>spec</code> is a textual specification: see <a href="https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions">the git docs</a> for a full list.</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L102-L110">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.GitCommit" href="#Base.LibGit2.GitCommit"><code>Base.LibGit2.GitCommit</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">GitCommit(repo::GitRepo, hash::AbstractGitHash)
|
||
GitCommit(repo::GitRepo, spec::AbstractString)</code></pre><p>Return a <code>GitCommit</code> object from <code>repo</code> specified by <code>hash</code>/<code>spec</code>.</p><ul><li><p><code>hash</code> is a full (<code>GitHash</code>) or partial (<code>GitShortHash</code>) hash.</p></li><li><p><code>spec</code> is a textual specification: see <a href="https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions">the git docs</a> for a full list.</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L102-L110">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.GitHash" href="#Base.LibGit2.GitHash"><code>Base.LibGit2.GitHash</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">GitHash</code></pre><p>A git object identifier, based on the sha-1 hash. It is a 20 byte string (40 hex digits) used to identify a <code>GitObject</code> in a repository.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L12-L17">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.GitObject" href="#Base.LibGit2.GitObject"><code>Base.LibGit2.GitObject</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">GitObject(repo::GitRepo, hash::AbstractGitHash)
|
||
GitObject(repo::GitRepo, spec::AbstractString)</code></pre><p>Return the specified object (<a href="libgit2.html#Base.LibGit2.GitCommit"><code>GitCommit</code></a>, <a href="libgit2.html#Base.LibGit2.GitBlob"><code>GitBlob</code></a>, <a href="libgit2.html#Base.LibGit2.GitTree"><code>GitTree</code></a> or <a href="libgit2.html#Base.LibGit2.GitTag"><code>GitTag</code></a>) from <code>repo</code> specified by <code>hash</code>/<code>spec</code>.</p><ul><li><p><code>hash</code> is a full (<code>GitHash</code>) or partial (<code>GitShortHash</code>) hash.</p></li><li><p><code>spec</code> is a textual specification: see <a href="https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions">the git docs</a> for a full list.</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L91-L100">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.GitRemote" href="#Base.LibGit2.GitRemote"><code>Base.LibGit2.GitRemote</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">GitRemote(repo::GitRepo, rmt_name::AbstractString, rmt_url::AbstractString) -> GitRemote</code></pre><p>Look up a remote git repository using its name and URL. Uses the default fetch refspec.</p><p><strong>Example</strong></p><pre><code class="language-julia">repo = LibGit2.init(repo_path)
|
||
remote = LibGit2.GitRemote(repo, "upstream", repo_url)</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/remote.jl#L3-L14">source</a><div><pre><code class="language-none">GitRemote(repo::GitRepo, rmt_name::AbstractString, rmt_url::AbstractString, fetch_spec::AbstractString) -> GitRemote</code></pre><p>Look up a remote git repository using the repository's name and URL, as well as specifications for how to fetch from the remote (e.g. which remote branch to fetch from).</p><p><strong>Example</strong></p><pre><code class="language-julia">repo = LibGit2.init(repo_path)
|
||
refspec = "+refs/heads/mybranch:refs/remotes/origin/mybranch"
|
||
remote = LibGit2.GitRemote(repo, "upstream", repo_url, refspec)</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/remote.jl#L23-L37">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.GitRemoteAnon" href="#Base.LibGit2.GitRemoteAnon"><code>Base.LibGit2.GitRemoteAnon</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">GitRemoteAnon(repo::GitRepo, url::AbstractString) -> GitRemote</code></pre><p>Look up a remote git repository using only its URL, not its name.</p><p><strong>Example</strong></p><pre><code class="language-julia">repo = LibGit2.init(repo_path)
|
||
remote = LibGit2.GitRemoteAnon(repo, repo_url)</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/remote.jl#L46-L57">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.GitRepo" href="#Base.LibGit2.GitRepo"><code>Base.LibGit2.GitRepo</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.GitRepo(path::AbstractString)</code></pre><p>Opens a git repository at <code>path</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L3-L7">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.GitRepoExt" href="#Base.LibGit2.GitRepoExt"><code>Base.LibGit2.GitRepoExt</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.GitRepoExt(path::AbstractString, flags::Cuint = Cuint(Consts.REPOSITORY_OPEN_DEFAULT))</code></pre><p>Opens a git repository at <code>path</code> with extended controls (for instance, if the current user must be a member of a special access group to read <code>path</code>).</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L15-L20">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.GitShortHash" href="#Base.LibGit2.GitShortHash"><code>Base.LibGit2.GitShortHash</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">GitShortHash</code></pre><p>This is a shortened form of <code>GitHash</code>, which can be used to identify a git object when it is unique.</p><p>Internally it is stored as two fields: a full-size <code>GitHash</code> (<code>hash</code>) and a length (<code>len</code>). Only the initial <code>len</code> hex digits of <code>hash</code> are used.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L24-L32">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.GitSignature" href="#Base.LibGit2.GitSignature"><code>Base.LibGit2.GitSignature</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.GitSignature</code></pre><p>This is a Julia wrapper around a pointer to a <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_signature"><code>git_signature</code></a> object.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L574-L579">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.GitStatus" href="#Base.LibGit2.GitStatus"><code>Base.LibGit2.GitStatus</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.GitStatus(repo::GitRepo; status_opts=StatusOptions())</code></pre><p>Collect information about the status of each file in the git repository <code>repo</code> (e.g. is the file modified, staged, etc.). <code>status_opts</code> can be used to set various options, for instance whether or not to look at untracked files or whether to include submodules or not.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/status.jl#L3-L11">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.GitTag" href="#Base.LibGit2.GitTag"><code>Base.LibGit2.GitTag</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">GitTag(repo::GitRepo, hash::AbstractGitHash)
|
||
GitTag(repo::GitRepo, spec::AbstractString)</code></pre><p>Return a <code>GitTag</code> object from <code>repo</code> specified by <code>hash</code>/<code>spec</code>.</p><ul><li><p><code>hash</code> is a full (<code>GitHash</code>) or partial (<code>GitShortHash</code>) hash.</p></li><li><p><code>spec</code> is a textual specification: see <a href="https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions">the git docs</a> for a full list.</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L102-L110">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.GitTree" href="#Base.LibGit2.GitTree"><code>Base.LibGit2.GitTree</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">GitTree(repo::GitRepo, hash::AbstractGitHash)
|
||
GitTree(repo::GitRepo, spec::AbstractString)</code></pre><p>Return a <code>GitTree</code> object from <code>repo</code> specified by <code>hash</code>/<code>spec</code>.</p><ul><li><p><code>hash</code> is a full (<code>GitHash</code>) or partial (<code>GitShortHash</code>) hash.</p></li><li><p><code>spec</code> is a textual specification: see <a href="https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions">the git docs</a> for a full list.</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L102-L110">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.IndexEntry" href="#Base.LibGit2.IndexEntry"><code>Base.LibGit2.IndexEntry</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.IndexEntry</code></pre><p>In-memory representation of a file entry in the index. Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_index_entry"><code>git_index_entry</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L379-L384">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.IndexTime" href="#Base.LibGit2.IndexTime"><code>Base.LibGit2.IndexTime</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.IndexTime</code></pre><p>Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_index_time"><code>git_index_time</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L369-L373">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.MergeOptions" href="#Base.LibGit2.MergeOptions"><code>Base.LibGit2.MergeOptions</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.MergeOptions</code></pre><p>Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_merge_options"><code>git_merge_options</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L806-L810">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.ProxyOptions" href="#Base.LibGit2.ProxyOptions"><code>Base.LibGit2.ProxyOptions</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.ProxyOptions</code></pre><p>Options for connecting through a proxy.</p><p>Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_proxy_options"><code>git_proxy_options</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L806-L812">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.PushOptions" href="#Base.LibGit2.PushOptions"><code>Base.LibGit2.PushOptions</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.PushOptions</code></pre><p>Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_push_options"><code>git_push_options</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L806-L810">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.RebaseOperation" href="#Base.LibGit2.RebaseOperation"><code>Base.LibGit2.RebaseOperation</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.RebaseOperation</code></pre><p>Describes a single instruction/operation to be performed during the rebase. Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_rebase_operation_t"><code>git_rebase_operation</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L423-L428">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.RebaseOptions" href="#Base.LibGit2.RebaseOptions"><code>Base.LibGit2.RebaseOptions</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.RebaseOptions</code></pre><p>Matches the <code>git_rebase_options</code> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L806-L810">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.RemoteCallbacks" href="#Base.LibGit2.RemoteCallbacks"><code>Base.LibGit2.RemoteCallbacks</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.RemoteCallbacks</code></pre><p>Callback settings. Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_remote_callbacks"><code>git_remote_callbacks</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L806-L811">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.SSHCredentials" href="#Base.LibGit2.SSHCredentials"><code>Base.LibGit2.SSHCredentials</code></a> — <span class="docstring-category">Type</span>.</div><div><p>SSH credentials type</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L688">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.SignatureStruct" href="#Base.LibGit2.SignatureStruct"><code>Base.LibGit2.SignatureStruct</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.SignatureStruct</code></pre><p>An action signature (e.g. for committers, taggers, etc). Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_signature"><code>git_signature</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L50-L55">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.StatusEntry" href="#Base.LibGit2.StatusEntry"><code>Base.LibGit2.StatusEntry</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.StatusEntry</code></pre><p>Providing the differences between the file as it exists in HEAD and the index, and providing the differences between the index and the working directory. Matches the <code>git_status_entry</code> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L455-L461">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.StatusOptions" href="#Base.LibGit2.StatusOptions"><code>Base.LibGit2.StatusOptions</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.StatusOptions</code></pre><p>Options to control how <code>git_status_foreach_ext()</code> will issue callbacks. Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_status_opt_t"><code>git_status_opt_t</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L806-L811">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.StrArrayStruct" href="#Base.LibGit2.StrArrayStruct"><code>Base.LibGit2.StrArrayStruct</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.StrArrayStruct</code></pre><p>A LibGit2 representation of an array of strings. Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_strarray"><code>git_strarray</code></a> struct.</p><p>When fetching data from LibGit2, a typical usage would look like:</p><pre><code class="language-julia">sa_ref = Ref(StrArrayStruct())
|
||
@check ccall(..., (Ptr{StrArrayStruct},), sa_ref)
|
||
res = convert(Vector{String}, sa_ref[])
|
||
free(sa_ref)</code></pre><p>In particular, note that <code>LibGit2.free</code> should be called afterward on the <code>Ref</code> object.</p><p>Conversely, when passing a vector of strings to LibGit2, it is generally simplest to rely on implicit conversion:</p><pre><code class="language-julia">strs = String[...]
|
||
@check ccall(..., (Ptr{StrArrayStruct},), strs)</code></pre><p>Note that no call to <code>free</code> is required as the data is allocated by Julia.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L62-L84">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.TimeStruct" href="#Base.LibGit2.TimeStruct"><code>Base.LibGit2.TimeStruct</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">LibGit2.TimeStruct</code></pre><p>Time in a signature. Matches the <a href="https://libgit2.github.com/libgit2/#HEAD/type/git_time"><code>git_time</code></a> struct.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L39-L44">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.UserPasswordCredentials" href="#Base.LibGit2.UserPasswordCredentials"><code>Base.LibGit2.UserPasswordCredentials</code></a> — <span class="docstring-category">Type</span>.</div><div><p>Credentials that support only <code>user</code> and <code>password</code> parameters</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L663">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.add_fetch!" href="#Base.LibGit2.add_fetch!"><code>Base.LibGit2.add_fetch!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">add_fetch!(repo::GitRepo, rmt::GitRemote, fetch_spec::String)</code></pre><p>Add a <em>fetch</em> refspec for the specified <code>rmt</code>. This refspec will contain information about which branch(es) to fetch from.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> LibGit2.add_fetch!(repo, remote, "upstream");
|
||
|
||
julia> LibGit2.fetch_refspecs(remote)
|
||
String["+refs/heads/*:refs/remotes/upstream/*"]</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/remote.jl#L165-L178">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.add_push!" href="#Base.LibGit2.add_push!"><code>Base.LibGit2.add_push!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">add_push!(repo::GitRepo, rmt::GitRemote, push_spec::String)</code></pre><p>Add a <em>push</em> refspec for the specified <code>rmt</code>. This refspec will contain information about which branch(es) to push to.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> LibGit2.add_push!(repo, remote, "refs/heads/master");
|
||
|
||
julia> remote = LibGit2.get(LibGit2.GitRemote, repo, branch);
|
||
|
||
julia> LibGit2.push_refspecs(remote)
|
||
String["refs/heads/master"]</code></pre><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>You may need to <a href="../stdlib/io-network.html#Base.close"><code>close</code></a> and reopen the <code>GitRemote</code> in question after updating its push refspecs in order for the change to take effect and for calls to <a href="libgit2.html#Base.LibGit2.push"><code>push</code></a> to work.</p></div></div></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/remote.jl#L185-L206">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.addblob!" href="#Base.LibGit2.addblob!"><code>Base.LibGit2.addblob!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.addblob!(repo::GitRepo, path::AbstractString)</code></pre><p>Reads the file at <code>path</code> and adds it to the object database of <code>repo</code> as a loose blob. Returns the <code>GitHash</code> of the resulting blob.</p><p><strong>Example</strong></p><pre><code class="language-julia">hash_str = hex(commit_oid)
|
||
blob_file = joinpath(repo_path, ".git", "objects", hash_str[1:2], hash_str[3:end])
|
||
id = LibGit2.addblob!(repo, blob_file)</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/blob.jl#L36-L49">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.authors" href="#Base.LibGit2.authors"><code>Base.LibGit2.authors</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">authors(repo::GitRepo) -> Vector{Signature}</code></pre><p>Returns all authors of commits to the <code>repo</code> repository.</p><p><strong>Example</strong></p><pre><code class="language-julia">repo = LibGit2.GitRepo(repo_path)
|
||
repo_file = open(joinpath(repo_path, test_file), "a")
|
||
|
||
println(repo_file, commit_msg)
|
||
flush(repo_file)
|
||
LibGit2.add!(repo, test_file)
|
||
sig = LibGit2.Signature("TEST", "TEST@TEST.COM", round(time(), 0), 0)
|
||
commit_oid1 = LibGit2.commit(repo, "commit1"; author=sig, committer=sig)
|
||
println(repo_file, randstring(10))
|
||
flush(repo_file)
|
||
LibGit2.add!(repo, test_file)
|
||
commit_oid2 = LibGit2.commit(repo, "commit2"; author=sig, committer=sig)
|
||
|
||
# will be a Vector of [sig, sig]
|
||
auths = LibGit2.authors(repo)</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L796-L820">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.branch" href="#Base.LibGit2.branch"><code>Base.LibGit2.branch</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">branch(repo::GitRepo)</code></pre><p>Equivalent to <code>git branch</code>. Create a new branch from the current HEAD.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L353-L358">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.branch!" href="#Base.LibGit2.branch!"><code>Base.LibGit2.branch!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">branch!(repo::GitRepo, branch_name::AbstractString, commit::AbstractString=""; kwargs...)</code></pre><p>Checkout a new git branch in the <code>repo</code> repository. <code>commit</code> is the <a href="libgit2.html#Base.LibGit2.GitHash"><code>GitHash</code></a>, in string form, which will be the start of the new branch. If <code>commit</code> is an empty string, the current HEAD will be used.</p><p>The keyword arguments are:</p><ul><li><p><code>track::AbstractString=""</code>: the name of the remote branch this new branch should track, if any. If empty (the default), no remote branch will be tracked.</p></li><li><p><code>force::Bool=false</code>: if <code>true</code>, branch creation will be forced.</p></li><li><p><code>set_head::Bool=true</code>: if <code>true</code>, after the branch creation finishes the branch head will be set as the HEAD of <code>repo</code>.</p></li></ul><p>Equivalent to <code>git checkout [-b|-B] <branch_name> [<commit>] [--track <track>]</code>.</p><p><strong>Example</strong></p><pre><code class="language-julia">repo = LibGit2.GitRepo(repo_path)
|
||
LibGit2.branch!(repo, "new_branch", set_head=false)</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L368-L393">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.checkout!" href="#Base.LibGit2.checkout!"><code>Base.LibGit2.checkout!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">checkout!(repo::GitRepo, commit::AbstractString=""; force::Bool=true)</code></pre><p>Equivalent to <code>git checkout [-f] --detach <commit></code>. Checkout the git commit <code>commit</code> (a <a href="libgit2.html#Base.LibGit2.GitHash"><code>GitHash</code></a> in string form) in <code>repo</code>. If <code>force</code> is <code>true</code>, force the checkout and discard any current changes. Note that this detaches the current HEAD.</p><p><strong>Example</strong></p><pre><code class="language-julia">repo = LibGit2.init(repo_path)
|
||
open(joinpath(LibGit2.path(repo), "file1"), "w") do f
|
||
write(f, "111
|
||
")
|
||
end
|
||
LibGit2.add!(repo, "file1")
|
||
commit_oid = LibGit2.commit(repo, "add file1")
|
||
open(joinpath(LibGit2.path(repo), "file1"), "w") do f
|
||
write(f, "112
|
||
")
|
||
end
|
||
# would fail without the force=true
|
||
# since there are modifications to the file
|
||
LibGit2.checkout!(repo, string(commit_oid), force=true)</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L460-L486">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.checkused!" href="#Base.LibGit2.checkused!"><code>Base.LibGit2.checkused!</code></a> — <span class="docstring-category">Function</span>.</div><div><p>Checks if credentials were used</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L124">source</a><div><p>Checks if credentials were used or failed authentication, see <code>LibGit2.credentials_callback</code></p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L726">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.clone" href="#Base.LibGit2.clone"><code>Base.LibGit2.clone</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">clone(repo_url::AbstractString, repo_path::AbstractString; kwargs...)</code></pre><p>Clone a remote repository located at <code>repo_url</code> to the local filesystem location <code>repo_path</code>.</p><p>The keyword arguments are:</p><ul><li><p><code>branch::AbstractString=""</code>: which branch of the remote to clone, if not the default repository branch (usually <code>master</code>).</p></li><li><p><code>isbare::Bool=false</code>: if <code>true</code>, clone the remote as a bare repository, which will make <code>repo_path</code> itself the git directory instead of <code>repo_path/.git</code>. This means that a working tree cannot be checked out. Plays the role of the git CLI argument <code>--bare</code>.</p></li><li><p><code>remote_cb::Ptr{Void}=C_NULL</code>: a callback which will be used to create the remote before it is cloned. If <code>C_NULL</code> (the default), no attempt will be made to create the remote - it will be assumed to already exist.</p></li><li><p><code>payload::Nullable{P<:AbstractCredentials}=Nullable{AbstractCredentials}()</code>: provides credentials if necessary, for instance if the remote is a private repository.</p></li></ul><p>Equivalent to <code>git clone [-b <branch>] [--bare] <repo_url> <repo_path></code>.</p><p><strong>Examples</strong></p><pre><code class="language-julia">repo_url = "https://github.com/JuliaLang/Example.jl"
|
||
repo1 = LibGit2.clone(repo_url, "test_path")
|
||
repo2 = LibGit2.clone(repo_url, "test_path", isbare=true)
|
||
julia_url = "https://github.com/JuliaLang/julia"
|
||
julia_repo = LibGit2.clone(julia_url, "julia_path", branch="release-0.6")</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L516-L546">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.commit" href="#Base.LibGit2.commit"><code>Base.LibGit2.commit</code></a> — <span class="docstring-category">Function</span>.</div><div><p>Wrapper around <code>git_commit_create</code> </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/commit.jl#L31">source</a><div><p>Commit changes to repository</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/commit.jl#L54">source</a><div><pre><code class="language-none">LibGit2.commit(rb::GitRebase, sig::GitSignature)</code></pre><p>Commits the current patch to the rebase <code>rb</code>, using <code>sig</code> as the committer. Is silent if the commit has already been applied.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/rebase.jl#L52-L57">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.create_branch" href="#Base.LibGit2.create_branch"><code>Base.LibGit2.create_branch</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.create_branch(repo::GitRepo, bname::AbstractString, commit_obj::GitCommit; force::Bool=false)</code></pre><p>Create a new branch in the repository <code>repo</code> with name <code>bname</code>, which points to commit <code>commit_obj</code> (which has to be part of <code>repo</code>). If <code>force</code> is <code>true</code>, overwrite an existing branch named <code>bname</code> if it exists. If <code>force</code> is <code>false</code> and a branch already exists named <code>bname</code>, this function will throw an error.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/reference.jl#L196-L204">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.credentials_callback" href="#Base.LibGit2.credentials_callback"><code>Base.LibGit2.credentials_callback</code></a> — <span class="docstring-category">Function</span>.</div><div><p>Credentials callback function</p><p>Function provides different credential acquisition functionality w.r.t. a connection protocol. If a payload is provided then <code>payload_ptr</code> should contain a <code>LibGit2.AbstractCredentials</code> object.</p><p>For <code>LibGit2.Consts.CREDTYPE_USERPASS_PLAINTEXT</code> type, if the payload contains fields: <code>user</code> & <code>pass</code>, they are used to create authentication credentials. Empty <code>user</code> name and <code>pass</code>word trigger an authentication error.</p><p>For <code>LibGit2.Consts.CREDTYPE_SSH_KEY</code> type, if the payload contains fields: <code>user</code>, <code>prvkey</code>, <code>pubkey</code> & <code>pass</code>, they are used to create authentication credentials. Empty <code>user</code> name triggers an authentication error.</p><p>Credentials are checked in the following order (if supported):</p><ul><li><p>ssh key pair (<code>ssh-agent</code> if specified in payload's <code>usesshagent</code> field)</p></li><li><p>plain text</p></li></ul><p><strong>Note</strong>: Due to the specifics of the <code>libgit2</code> authentication procedure, when authentication fails, this function is called again without any indication whether authentication was successful or not. To avoid an infinite loop from repeatedly using the same faulty credentials, the <code>checkused!</code> function can be called. This function returns <code>true</code> if the credentials were used. Using credentials triggers a user prompt for (re)entering required information. <code>UserPasswordCredentials</code> and <code>CachedCredentials</code> are implemented using a call counting strategy that prevents repeated usage of faulty credentials.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/callbacks.jl#L174-L200">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.credentials_cb" href="#Base.LibGit2.credentials_cb"><code>Base.LibGit2.credentials_cb</code></a> — <span class="docstring-category">Function</span>.</div><div><p>C function pointer for <code>credentials_callback</code></p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/callbacks.jl#L262">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.default_signature" href="#Base.LibGit2.default_signature"><code>Base.LibGit2.default_signature</code></a> — <span class="docstring-category">Function</span>.</div><div><p>Return signature object. Free it after use.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/signature.jl#L45">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.delete_branch" href="#Base.LibGit2.delete_branch"><code>Base.LibGit2.delete_branch</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.delete_branch(branch::GitReference)</code></pre><p>Delete the branch pointed to by <code>branch</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/reference.jl#L216-L220">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.diff_files" href="#Base.LibGit2.diff_files"><code>Base.LibGit2.diff_files</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">diff_files(repo::GitRepo, branch1::AbstractString, branch2::AbstractString; kwarg...) -> Vector{AbstractString}</code></pre><p>Show which files have changed in the git repository <code>repo</code> between branches <code>branch1</code> and <code>branch2</code>.</p><p>The keyword argument is:</p><ul><li><p><code>filter::Set{Consts.DELTA_STATUS}=Set([Consts.DELTA_ADDED, Consts.DELTA_MODIFIED, Consts.DELTA_DELETED]))</code>, and it sets options for the diff. The default is to show files added, modified, or deleted.</p></li></ul><p>Returns only the <em>names</em> of the files which have changed, <em>not</em> their contents.</p><p><strong>Example</strong></p><pre><code class="language-julia">LibGit2.branch!(repo, "branch/a")
|
||
LibGit2.branch!(repo, "branch/b")
|
||
# add a file to repo
|
||
open(joinpath(LibGit2.path(repo),"file"),"w") do f
|
||
write(f, "hello repo
|
||
")
|
||
end
|
||
LibGit2.add!(repo, "file")
|
||
LibGit2.commit(repo, "add file")
|
||
# returns ["file"]
|
||
filt = Set([LibGit2.Consts.DELTA_ADDED])
|
||
files = LibGit2.diff_files(repo, "branch/a", "branch/b", filter=filt)
|
||
# returns [] because existing files weren't modified
|
||
filt = Set([LibGit2.Consts.DELTA_MODIFIED])
|
||
files = LibGit2.diff_files(repo, "branch/a", "branch/b", filter=filt)</code></pre><p>Equivalent to <code>git diff --name-only --diff-filter=<filter> <branch1> <branch2></code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L158-L191">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.fetch" href="#Base.LibGit2.fetch"><code>Base.LibGit2.fetch</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">fetch(rmt::GitRemote, refspecs; options::FetchOptions=FetchOptions(), msg="")</code></pre><p>Fetch from the specified <code>rmt</code> remote git repository, using <code>refspecs</code> to determine which remote branch(es) to fetch. The keyword arguments are:</p><ul><li><p><code>options</code>: determines the options for the fetch, e.g. whether to prune afterwards.</p></li><li><p><code>msg</code>: a message to insert into the reflogs.</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/remote.jl#L213-L221">source</a><div><pre><code class="language-none">fetch(repo::GitRepo; kwargs...)</code></pre><p>Fetches updates from an upstream of the repository <code>repo</code>.</p><p>The keyword arguments are:</p><ul><li><p><code>remote::AbstractString="origin"</code>: which remote, specified by name, of <code>repo</code> to fetch from. If this is empty, the URL will be used to construct an anonymous remote.</p></li><li><p><code>remoteurl::AbstractString=""</code>: the URL of <code>remote</code>. If not specified, will be assumed based on the given name of <code>remote</code>.</p></li><li><p><code>refspecs=AbstractString[]</code>: determines properties of the fetch.</p></li><li><p><code>payload=Nullable{AbstractCredentials}()</code>: provides credentials, if necessary, for instance if <code>remote</code> is a private repository.</p></li></ul><p>Equivalent to <code>git fetch [<remoteurl>|<repo>] [<refspecs>]</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L283-L299">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.fetch_refspecs" href="#Base.LibGit2.fetch_refspecs"><code>Base.LibGit2.fetch_refspecs</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">fetch_refspecs(rmt::GitRemote) -> Vector{String}</code></pre><p>Get the <em>fetch</em> refspecs for the specified <code>rmt</code>. These refspecs contain information about which branch(es) to fetch from.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/remote.jl#L135-L140">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.fetchhead_foreach_cb" href="#Base.LibGit2.fetchhead_foreach_cb"><code>Base.LibGit2.fetchhead_foreach_cb</code></a> — <span class="docstring-category">Function</span>.</div><div><p>C function pointer for <code>fetchhead_foreach_callback</code></p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/callbacks.jl#L264">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.ffmerge!" href="#Base.LibGit2.ffmerge!"><code>Base.LibGit2.ffmerge!</code></a> — <span class="docstring-category">Function</span>.</div><div><p>Fastforward merge changes into current head </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/merge.jl#L48">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.fullname" href="#Base.LibGit2.fullname"><code>Base.LibGit2.fullname</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.fullname(ref::GitReference)</code></pre><p>Return the name of the reference pointed to by the symbolic reference <code>ref</code>. If <code>ref</code> is not a symbolic reference, returns an empty string.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/reference.jl#L82-L88">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.get_creds!" href="#Base.LibGit2.get_creds!"><code>Base.LibGit2.get_creds!</code></a> — <span class="docstring-category">Function</span>.</div><div><p>Obtain the cached credentials for the given host+protocol (credid), or return and store the default if not found</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L735">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.gitdir" href="#Base.LibGit2.gitdir"><code>Base.LibGit2.gitdir</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.gitdir(repo::GitRepo)</code></pre><p>Returns the location of the "git" files of <code>repo</code>:</p><ul><li><p>for normal repositories, this is the location of the <code>.git</code> folder.</p></li><li><p>for bare repositories, this is the location of the repository itself.</p></li></ul><p>See also <a href="libgit2.html#Base.LibGit2.workdir"><code>workdir</code></a>, <a href="libgit2.html#Base.LibGit2.path"><code>path</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L150-L159">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.head" href="#Base.LibGit2.head"><code>Base.LibGit2.head</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.head(repo::GitRepo) -> GitReference</code></pre><p>Returns a <code>GitReference</code> to the current HEAD of <code>repo</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/reference.jl#L33-L37">source</a><div><pre><code class="language-none">head(pkg::AbstractString) -> String</code></pre><p>Return current HEAD <a href="libgit2.html#Base.LibGit2.GitHash"><code>GitHash</code></a> of the <code>pkg</code> repo as a string.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L45-L50">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.head!" href="#Base.LibGit2.head!"><code>Base.LibGit2.head!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.head!(repo::GitRepo, ref::GitReference) -> GitReference</code></pre><p>Set the HEAD of <code>repo</code> to the object pointed to by <code>ref</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/reference.jl#L225-L229">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.head_oid" href="#Base.LibGit2.head_oid"><code>Base.LibGit2.head_oid</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.head_oid(repo::GitRepo) -> GitHash</code></pre><p>Lookup the object id of the current HEAD of git repository <code>repo</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L50-L55">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.headname" href="#Base.LibGit2.headname"><code>Base.LibGit2.headname</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.headname(repo::GitRepo)</code></pre><p>Lookup the name of the current HEAD of git repository <code>repo</code>. If <code>repo</code> is currently detached, returns the name of the HEAD it's detached from.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L65-L72">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.init" href="#Base.LibGit2.init"><code>Base.LibGit2.init</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.init(path::AbstractString, bare::Bool=false) -> GitRepo</code></pre><p>Opens a new git repository at <code>path</code>. If <code>bare</code> is <code>false</code>, the working tree will be created in <code>path/.git</code>. If <code>bare</code> is <code>true</code>, no working directory will be created.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L36-L42">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.is_ancestor_of" href="#Base.LibGit2.is_ancestor_of"><code>Base.LibGit2.is_ancestor_of</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">is_ancestor_of(a::AbstractString, b::AbstractString, repo::GitRepo) -> Bool</code></pre><p>Returns <code>true</code> if <code>a</code>, a <a href="libgit2.html#Base.LibGit2.GitHash"><code>GitHash</code></a> in string form, is an ancestor of <code>b</code>, a <a href="libgit2.html#Base.LibGit2.GitHash"><code>GitHash</code></a> in string form.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> repo = LibGit2.GitRepo(repo_path);
|
||
|
||
julia> LibGit2.add!(repo, test_file1);
|
||
|
||
julia> commit_oid1 = LibGit2.commit(repo, "commit1");
|
||
|
||
julia> LibGit2.add!(repo, test_file2);
|
||
|
||
julia> commit_oid2 = LibGit2.commit(repo, "commit2");
|
||
|
||
julia> LibGit2.is_ancestor_of(string(commit_oid1), string(commit_oid2), repo)
|
||
true</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L215-L237">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.isbinary" href="#Base.LibGit2.isbinary"><code>Base.LibGit2.isbinary</code></a> — <span class="docstring-category">Function</span>.</div><div><p>Use a heuristic to guess if a file is binary: searching for NULL bytes and looking for a reasonable ratio of printable to non-printable characters among the first 8000 bytes.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/blob.jl#L26-L30">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.iscommit" href="#Base.LibGit2.iscommit"><code>Base.LibGit2.iscommit</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">iscommit(id::AbstractString, repo::GitRepo) -> Bool</code></pre><p>Checks if commit <code>id</code> (which is a <a href="libgit2.html#Base.LibGit2.GitHash"><code>GitHash</code></a> in string form) is in the repository.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> repo = LibGit2.GitRepo(repo_path);
|
||
|
||
julia> LibGit2.add!(repo, test_file);
|
||
|
||
julia> commit_oid = LibGit2.commit(repo, "add test_file");
|
||
|
||
julia> LibGit2.iscommit(string(commit_oid), repo)
|
||
true</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L70-L88">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.isdiff" href="#Base.LibGit2.isdiff"><code>Base.LibGit2.isdiff</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.isdiff(repo::GitRepo, treeish::AbstractString, pathspecs::AbstractString=""; cached::Bool=false)</code></pre><p>Checks if there are any differences between the tree specified by <code>treeish</code> and the tracked files in the working tree (if <code>cached=false</code>) or the index (if <code>cached=true</code>). <code>pathspecs</code> are the specifications for options for the diff.</p><p><strong>Example</strong></p><pre><code class="language-julia">repo = LibGit2.GitRepo(repo_path)
|
||
LibGit2.isdiff(repo, "HEAD") # should be false
|
||
open(joinpath(repo_path, new_file), "a") do f
|
||
println(f, "here's my cool new file")
|
||
end
|
||
LibGit2.isdiff(repo, "HEAD") # now true</code></pre><p>Equivalent to <code>git diff-index <treeish> [-- <pathspecs>]</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L127-L145">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.isdirty" href="#Base.LibGit2.isdirty"><code>Base.LibGit2.isdirty</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.isdirty(repo::GitRepo, pathspecs::AbstractString=""; cached::Bool=false) -> Bool</code></pre><p>Checks if there have been any changes to tracked files in the working tree (if <code>cached=false</code>) or the index (if <code>cached=true</code>). <code>pathspecs</code> are the specifications for options for the diff.</p><p><strong>Example</strong></p><pre><code class="language-julia">repo = LibGit2.GitRepo(repo_path)
|
||
LibGit2.isdirty(repo) # should be false
|
||
open(joinpath(repo_path, new_file), "a") do f
|
||
println(f, "here's my cool new file")
|
||
end
|
||
LibGit2.isdirty(repo) # now true
|
||
LibGit2.isdirty(repo, new_file) # now true</code></pre><p>Equivalent to <code>git diff-index HEAD [-- <pathspecs>]</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L104-L123">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.isorphan" href="#Base.LibGit2.isorphan"><code>Base.LibGit2.isorphan</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.isorphan(repo::GitRepo)</code></pre><p>Checks if the current branch is an "orphan" branch, i.e. has no commits. The first commit to this branch will have no parents.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/reference.jl#L21-L26">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.lookup_branch" href="#Base.LibGit2.lookup_branch"><code>Base.LibGit2.lookup_branch</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">lookup_branch(repo::GitRepo, branch_name::AbstractString, remote::Bool=false) -> Nullable{GitReference}</code></pre><p>Determine if the branch specified by <code>branch_name</code> exists in the repository <code>repo</code>. If <code>remote</code> is <code>true</code>, <code>repo</code> is assumed to be a remote git repository. Otherwise, it is part of the local filesystem.</p><p><code>lookup_branch</code> returns a <a href="../stdlib/base.html#Base.Nullable"><code>Nullable</code></a>, which will be null if the requested branch does not exist yet. If the branch does exist, the <code>Nullable</code> contains a <code>GitReference</code> to the branch.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/reference.jl#L237-L247">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.mirror_callback" href="#Base.LibGit2.mirror_callback"><code>Base.LibGit2.mirror_callback</code></a> — <span class="docstring-category">Function</span>.</div><div><p>Mirror callback function</p><p>Function sets <code>+refs/*:refs/*</code> refspecs and <code>mirror</code> flag for remote reference.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/callbacks.jl#L3-L7">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.mirror_cb" href="#Base.LibGit2.mirror_cb"><code>Base.LibGit2.mirror_cb</code></a> — <span class="docstring-category">Function</span>.</div><div><p>C function pointer for <code>mirror_callback</code></p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/callbacks.jl#L260">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.name" href="#Base.LibGit2.name"><code>Base.LibGit2.name</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.name(ref::GitReference)</code></pre><p>Return the full name of <code>ref</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/reference.jl#L97-L101">source</a><div><pre><code class="language-none">name(rmt::GitRemote)</code></pre><p>Get the name of a remote repository, for instance <code>"origin"</code>. If the remote is anonymous (see <a href="libgit2.html#Base.LibGit2.GitRemoteAnon"><code>GitRemoteAnon</code></a>) the name will be an empty string <code>""</code>.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> repo_url = "https://github.com/JuliaLang/Example.jl";
|
||
|
||
julia> repo = LibGit2.clone(cache_repo, "test_directory");
|
||
|
||
julia> remote = LibGit2.GitRemote(repo, "origin", repo_url);
|
||
|
||
julia> name(remote)
|
||
"origin"</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/remote.jl#L109-L128">source</a><div><pre><code class="language-none">LibGit2.name(tag::GitTag)</code></pre><p>The name of <code>tag</code> (e.g. <code>"v0.5"</code>).</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/tag.jl#L54-L58">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.need_update" href="#Base.LibGit2.need_update"><code>Base.LibGit2.need_update</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">need_update(repo::GitRepo)</code></pre><p>Equivalent to <code>git update-index</code>. Returns <code>true</code> if <code>repo</code> needs updating.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L57-L62">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.objtype" href="#Base.LibGit2.objtype"><code>Base.LibGit2.objtype</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">objtype(obj_type::Consts.OBJECT)</code></pre><p>Returns the type corresponding to the enum value.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L640-L644">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.path" href="#Base.LibGit2.path"><code>Base.LibGit2.path</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.path(repo::GitRepo)</code></pre><p>The base file path of the repository <code>repo</code>.</p><ul><li><p>for normal repositories, this will typically be the parent directory of the ".git" directory (note: this may be different than the working directory, see <code>workdir</code> for more details).</p></li><li><p>for bare repositories, this is the location of the "git" files.</p></li></ul><p>See also <a href="libgit2.html#Base.LibGit2.gitdir"><code>gitdir</code></a>, <a href="libgit2.html#Base.LibGit2.workdir"><code>workdir</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L186-L197">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.peel" href="#Base.LibGit2.peel"><code>Base.LibGit2.peel</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">peel([T,] ref::GitReference)</code></pre><p>Recursively peel <code>ref</code> until an object of type <code>T</code> is obtained. If no <code>T</code> is provided, then <code>ref</code> will be peeled until an object other than a <a href="libgit2.html#Base.LibGit2.GitTag"><code>GitTag</code></a> is obtained.</p><ul><li><p>A <code>GitTag</code> will be peeled to the object it references.</p></li><li><p>A <a href="libgit2.html#Base.LibGit2.GitCommit"><code>GitCommit</code></a> will be peeled to a <a href="libgit2.html#Base.LibGit2.GitTree"><code>GitTree</code></a>.</p></li></ul><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>Only annotated tags can be peeled to <code>GitTag</code> objects. Lightweight tags (the default) are references under <code>refs/tags/</code> which point directly to <code>GitCommit</code> objects.</p></div></div></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/reference.jl#L161-L173">source</a><div><pre><code class="language-none">peel([T,] obj::GitObject)</code></pre><p>Recursively peel <code>obj</code> until an object of type <code>T</code> is obtained. If no <code>T</code> is provided, then <code>obj</code> will be peeled until the type changes.</p><ul><li><p>A <code>GitTag</code> will be peeled to the object it references.</p></li><li><p>A <code>GitCommit</code> will be peeled to a <code>GitTree</code>.</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L211-L219">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.posixpath" href="#Base.LibGit2.posixpath"><code>Base.LibGit2.posixpath</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.posixpath(path)</code></pre><p>Standardise the path string <code>path</code> to use POSIX separators.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/utils.jl#L57-L61">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.push" href="#Base.LibGit2.push"><code>Base.LibGit2.push</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">push(rmt::GitRemote, refspecs; force::Bool=false, options::PushOptions=PushOptions())</code></pre><p>Push to the specified <code>rmt</code> remote git repository, using <code>refspecs</code> to determine which remote branch(es) to push to. The keyword arguments are:</p><ul><li><p><code>force</code>: if <code>true</code>, a force-push will occur, disregarding conflicts.</p></li><li><p><code>options</code>: determines the options for the push, e.g. which proxy headers to use.</p></li></ul><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>You can add information about the push refspecs in two other ways: by setting an option in the repository's <code>GitConfig</code> (with <code>push.default</code> as the key) or by calling <a href="libgit2.html#Base.LibGit2.add_push!"><code>add_push!</code></a>. Otherwise you will need to explicitly specify a push refspec in the call to <code>push</code> for it to have any effect, like so: <code>LibGit2.push(repo, refspecs=["refs/heads/master"])</code>.</p></div></div></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/remote.jl#L231-L246">source</a><div><pre><code class="language-none">push(repo::GitRepo; kwargs...)</code></pre><p>Pushes updates to an upstream of <code>repo</code>.</p><p>The keyword arguments are:</p><ul><li><p><code>remote::AbstractString="origin"</code>: the name of the upstream remote to push to.</p></li><li><p><code>remoteurl::AbstractString=""</code>: the URL of <code>remote</code>.</p></li><li><p><code>refspecs=AbstractString[]</code>: determines properties of the push.</p></li><li><p><code>force::Bool=false</code>: determines if the push will be a force push, overwriting the remote branch.</p></li><li><p><code>payload=Nullable{AbstractCredentials}()</code>: provides credentials, if necessary, for instance if <code>remote</code> is a private repository.</p></li></ul><p>Equivalent to <code>git push [<remoteurl>|<repo>] [<refspecs>]</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L318-L333">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.push_refspecs" href="#Base.LibGit2.push_refspecs"><code>Base.LibGit2.push_refspecs</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">push_refspecs(rmt::GitRemote) -> Vector{String}</code></pre><p>Get the <em>push</em> refspecs for the specified <code>rmt</code>. These refspecs contain information about which branch(es) to push to.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/remote.jl#L150-L155">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.read_tree!" href="#Base.LibGit2.read_tree!"><code>Base.LibGit2.read_tree!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.read_tree!(idx::GitIndex, tree::GitTree)
|
||
LibGit2.read_tree!(idx::GitIndex, treehash::AbstractGitHash)</code></pre><p>Read the tree <code>tree</code> (or the tree pointed to by <code>treehash</code> in the repository owned by <code>idx</code>) into the index <code>idx</code>. The current index contents will be replaced.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/index.jl#L35-L41">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.rebase!" href="#Base.LibGit2.rebase!"><code>Base.LibGit2.rebase!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.rebase!(repo::GitRepo, upstream::AbstractString="", newbase::AbstractString="")</code></pre><p>Attempt an automatic merge rebase of the current branch, from <code>upstream</code> if provided, or otherwise from the upstream tracking branch. <code>newbase</code> is the branch to rebase onto. By default this is <code>upstream</code>.</p><p>If any conflicts arise which cannot be automatically resolved, the rebase will abort, leaving the repository and working tree in its original state, and the function will throw a <code>GitError</code>. This is roughly equivalent to the following command line statement:</p><pre><code class="language-none">git rebase --merge [<upstream>]
|
||
if [ -d ".git/rebase-merge" ]; then
|
||
git rebase --abort
|
||
fi</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L730-L746">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.ref_list" href="#Base.LibGit2.ref_list"><code>Base.LibGit2.ref_list</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.ref_list(repo::GitRepo) -> Vector{String}</code></pre><p>Get a list of all reference names in the <code>repo</code> repository.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/reference.jl#L182-L186">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.reftype" href="#Base.LibGit2.reftype"><code>Base.LibGit2.reftype</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.reftype(ref::GitReference) -> Cint</code></pre><p>Returns a <code>Cint</code> corresponding to the type of <code>ref</code>:</p><ul><li><p><code>0</code> if the reference is invalid</p></li><li><p><code>1</code> if the reference is an object id</p></li><li><p><code>2</code> if the reference is symbolic</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/reference.jl#L70-L77">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.remotes" href="#Base.LibGit2.remotes"><code>Base.LibGit2.remotes</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.remotes(repo::GitRepo)</code></pre><p>Returns a vector of the names of the remotes of <code>repo</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L291-L295">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.reset!" href="#Base.LibGit2.reset!"><code>Base.LibGit2.reset!</code></a> — <span class="docstring-category">Function</span>.</div><div><p>Resets credentials for another use</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L127">source</a><div><p>Updates some entries, determined by the <code>pathspecs</code>, in the index from the target commit tree.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L253">source</a><div><p>Sets the current head to the specified commit oid and optionally resets the index and working tree to match.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L263">source</a><div><p>git reset [<committish>] [–] <pathspecs>... </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L565">source</a><div><pre><code class="language-none">reset!(repo::GitRepo, id::GitHash, mode::Cint = Consts.RESET_MIXED)</code></pre><p>Reset the repository <code>repo</code> to its state at <code>id</code>, using one of three modes set by <code>mode</code>:</p><ol><li><p><code>Consts.RESET_SOFT</code> - move HEAD to <code>id</code>.</p></li><li><p><code>Consts.RESET_MIXED</code> - default, move HEAD to <code>id</code> and reset the index to <code>id</code>.</p></li><li><p><code>Consts.RESET_HARD</code> - move HEAD to <code>id</code>, reset the index to <code>id</code>, and discard all working changes.</p></li></ol><p>Equivalent to <code>git reset [--soft | --mixed | --hard] <id></code>.</p><p><strong>Example</strong></p><pre><code class="language-julia">repo = LibGit2.GitRepo(repo_path)
|
||
head_oid = LibGit2.head_oid(repo)
|
||
open(joinpath(repo_path, "file1"), "w") do f
|
||
write(f, "111
|
||
")
|
||
end
|
||
LibGit2.add!(repo, "file1")
|
||
mode = LibGit2.Consts.RESET_HARD
|
||
# will discard the changes to file1
|
||
# and unstage it
|
||
new_head = LibGit2.reset!(repo, head_oid, mode)</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L572-L598">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.restore" href="#Base.LibGit2.restore"><code>Base.LibGit2.restore</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">restore(s::State, repo::GitRepo)</code></pre><p>Return a repository <code>repo</code> to a previous <code>State</code> <code>s</code>, for example the HEAD of a branch before a merge attempt. <code>s</code> can be generated using the <a href="libgit2.html#Base.LibGit2.snapshot"><code>snapshot</code></a> function.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L859-L865">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.revcount" href="#Base.LibGit2.revcount"><code>Base.LibGit2.revcount</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.revcount(repo::GitRepo, commit1::AbstractString, commit2::AbstractString)</code></pre><p>List the number of revisions between <code>commit1</code> and <code>commit2</code> (committish OIDs in string form). Since <code>commit1</code> and <code>commit2</code> may be on different branches, <code>revcount</code> performs a "left-right" revision list (and count), returning a tuple of <code>Int</code>s - the number of left and right commits, respectively. A left (or right) commit refers to which side of a symmetric difference in a tree the commit is reachable from.</p><p>Equivalent to <code>git rev-list --left-right --count <commit1> <commit2></code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L601-L611">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.set_remote_url" href="#Base.LibGit2.set_remote_url"><code>Base.LibGit2.set_remote_url</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">set_remote_url(repo::GitRepo, url::AbstractString; remote::AbstractString="origin")</code></pre><p>Set the <code>url</code> for <code>remote</code> for the git repository <code>repo</code>. The default name of the remote is <code>"origin"</code>.</p><p><strong>Examples</strong></p><pre><code class="language-julia">repo_path = joinpath("test_directory", "Example")
|
||
repo = LibGit2.init(repo_path)
|
||
url1 = "https://github.com/JuliaLang/Example.jl"
|
||
LibGit2.set_remote_url(repo, url1, remote="upstream")
|
||
url2 = "https://github.com/JuliaLang/Example2.jl"
|
||
LibGit2.set_remote_url(repo_path, url2, remote="upstream2")</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L243-L259">source</a><div><pre><code class="language-none">set_remote_url(path::AbstractString, url::AbstractString; remote::AbstractString="origin")</code></pre><p>Set the <code>url</code> for <code>remote</code> for the git repository located at <code>path</code>. The default name of the remote is <code>"origin"</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L267-L272">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.shortname" href="#Base.LibGit2.shortname"><code>Base.LibGit2.shortname</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.shortname(ref::GitReference)</code></pre><p>Returns a shortened version of the name of <code>ref</code> that's "human-readable".</p><pre><code class="language-julia-repl">julia> repo = LibGit2.GitRepo(path_to_repo);
|
||
|
||
julia> branch_ref = LibGit2.head(repo);
|
||
|
||
julia> LibGit2.name(branch_ref)
|
||
"refs/heads/master"
|
||
|
||
julia> LibGit2.shortname(branch_ref)
|
||
"master"</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/reference.jl#L45-L62">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.snapshot" href="#Base.LibGit2.snapshot"><code>Base.LibGit2.snapshot</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">snapshot(repo::GitRepo) -> State</code></pre><p>Take a snapshot of the current state of the repository <code>repo</code>, storing the current HEAD, index, and any uncommitted work. The output <code>State</code> can be used later during a call to <a href="libgit2.html#Base.LibGit2.restore"><code>restore</code></a> to return the repository to the snapshotted state.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/libgit2.jl#L830-L837">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.status" href="#Base.LibGit2.status"><code>Base.LibGit2.status</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.status(repo::GitRepo, path::String)</code></pre><p>Lookup the status of the file at <code>path</code> in the git repository <code>repo</code>. For instance, this can be used to check if the file at <code>path</code> has been modified and needs to be staged and committed.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/status.jl#L35-L42">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.tag_create" href="#Base.LibGit2.tag_create"><code>Base.LibGit2.tag_create</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.tag_create(repo::GitRepo, tag::AbstractString, commit; kwargs...)</code></pre><p>Create a new git tag <code>tag</code> (e.g. <code>"v0.5"</code>) in the repository <code>repo</code>, at the commit <code>commit</code>.</p><p>The keyword arguments are:</p><ul><li><p><code>msg::AbstractString=""</code>: the message for the tag.</p></li><li><p><code>force::Bool=false</code>: if <code>true</code>, existing references will be overwritten.</p></li><li><p><code>sig::Signature=Signature(repo)</code>: the tagger's signature.</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/tag.jl#L27-L37">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.tag_delete" href="#Base.LibGit2.tag_delete"><code>Base.LibGit2.tag_delete</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.tag_delete(repo::GitRepo, tag::AbstractString)</code></pre><p>Remove the git tag <code>tag</code> from the repository <code>repo</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/tag.jl#L17-L21">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.tag_list" href="#Base.LibGit2.tag_list"><code>Base.LibGit2.tag_list</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.tag_list(repo::GitRepo) -> Vector{String}</code></pre><p>Get a list of all tags in the git repository <code>repo</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/tag.jl#L3-L7">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.target" href="#Base.LibGit2.target"><code>Base.LibGit2.target</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.target(tag::GitTag)</code></pre><p>The <code>GitHash</code> of the target object of <code>tag</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/tag.jl#L66-L70">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.treewalk" href="#Base.LibGit2.treewalk"><code>Base.LibGit2.treewalk</code></a> — <span class="docstring-category">Function</span>.</div><div><p>Traverse the entries in a tree and its subtrees in post or pre order.</p><p>Function parameter should have following signature:</p><pre><code class="language-none">(Cstring, Ptr{Void}, Ptr{Void}) -> Cint</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/tree.jl#L3-L9">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.upstream" href="#Base.LibGit2.upstream"><code>Base.LibGit2.upstream</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">upstream(ref::GitReference) -> Nullable{GitReference}</code></pre><p>Determine if the branch containing <code>ref</code> has a specified upstream branch.</p><p><code>upstream</code> returns a <a href="../stdlib/base.html#Base.Nullable"><code>Nullable</code></a>, which will be null if the requested branch does not have an upstream counterpart. If the upstream branch does exist, the <code>Nullable</code> contains a <code>GitReference</code> to the upstream branch.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/reference.jl#L268-L276">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.url" href="#Base.LibGit2.url"><code>Base.LibGit2.url</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">url(rmt::GitRemote)</code></pre><p>Get the fetch URL of a remote git repository.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> repo_url = "https://github.com/JuliaLang/Example.jl";
|
||
|
||
julia> repo = LibGit2.init(mktempdir());
|
||
|
||
julia> remote = LibGit2.GitRemote(repo, "origin", repo_url);
|
||
|
||
julia> LibGit2.url(remote)
|
||
"https://github.com/JuliaLang/Example.jl"</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/remote.jl#L74-L91">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.with" href="#Base.LibGit2.with"><code>Base.LibGit2.with</code></a> — <span class="docstring-category">Function</span>.</div><div><p>Resource management helper function</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/types.jl#L604-L606">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.LibGit2.workdir" href="#Base.LibGit2.workdir"><code>Base.LibGit2.workdir</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">LibGit2.workdir(repo::GitRepo)</code></pre><p>The location of the working directory of <code>repo</code>. This will throw an error for bare repositories.</p><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>This will typically be the parent directory of <code>gitdir(repo)</code>, but can be different in some cases: e.g. if either the <code>core.worktree</code> configuration variable or the <code>GIT_WORK_TREE</code> environment variable is set.</p></div></div><p>See also <a href="libgit2.html#Base.LibGit2.gitdir"><code>gitdir</code></a>, <a href="libgit2.html#Base.LibGit2.path"><code>path</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/blob/d55cadc350d426a95fd967121ba77494d08364c8/base/libgit2/repository.jl#L165-L178">source</a></section><footer><hr/><a class="previous" href="offset-arrays.html"><span class="direction">Previous</span><span class="title">Arrays with custom indices</span></a><a class="next" href="require.html"><span class="direction">Next</span><span class="title">Module loading</span></a></footer></article></body></html>
|