<?xml version='1.0'?> <!--*-nxml-*-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<!--
Copyright 2014 Anne LoVerso <anne.loverso@students.olin.edu>

SPDX-License-Identifier: LGPL-2.0+

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-->

<refentry id="ostree">

    <refentryinfo>
        <title>ostree pull</title>
        <productname>OSTree</productname>

        <authorgroup>
            <author>
                <contrib>Developer</contrib>
                <firstname>Colin</firstname>
                <surname>Walters</surname>
                <email>walters@verbum.org</email>
            </author>
        </authorgroup>
    </refentryinfo>

    <refmeta>
        <refentrytitle>ostree pull</refentrytitle>
        <manvolnum>1</manvolnum>
    </refmeta>

    <refnamediv>
        <refname>ostree-pull</refname>
        <refpurpose>Download data from a remote repository</refpurpose>
    </refnamediv>

    <refsynopsisdiv>
            <cmdsynopsis>
                <command>ostree pull <arg choice="req">REMOTE</arg> <arg choice="opt">BRANCH</arg></command>
            </cmdsynopsis>
    </refsynopsisdiv>

    <refsect1>
        <title>Options</title>

        <variablelist>
            <varlistentry>
                <term><option>--commit-metadata-only</option></term>

                <listitem><para>
                    Fetch only the commit metadata.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--disable-fsync</option></term>

                <listitem><para>
                    Do no invoke fsync().
                </para></listitem>
            </varlistentry>

            <varlistentry>
              <term><option>--localcache-repo</option></term>

              <listitem><para>
                Like git's <literal>clone --reference</literal>.  Reuse the provided
                OSTree repo as a local object cache when doing HTTP fetches.
                May be specified multiple times.
              </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--untrusted</option></term>

                <listitem><para>
                    Do not trust local sources, verify checksums and don't hardlink into source.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--disable-static-deltas</option></term>

                <listitem><para>
                    Do not use static deltas.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--mirror</option></term>

                <listitem><para>
                    Write refs suitable for a mirror, i.e. refs are stored in the
                    <literal>heads/</literal> directory rather than the
                    <literal>remotes/</literal> directory. This makes the target repo
                    suitable to be exported for other clients to pull from as an ostree
                    remote. If no specific refs are specified, all refs will be fetched (the
                    remote must have a summary file present).
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--subpath</option>=SUBPATH</term>

                <listitem><para>
                    Only pull the provided subpath.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--depth</option>=DEPTH</term>

                <listitem><para>
                    Traverse DEPTH parents (-1=infinite) (default: 0).
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--network-retries</option>=N</term>

                <listitem><para>
                    Specifies how many times each download should be retried upon error (default: 5)
                </para></listitem>
            </varlistentry>
        </variablelist>
    </refsect1>

    <refsect1>
        <title>Description</title>

      <para>
	  Without --mirror, this command will create new refs
	  under <literal>remotes/REMOTE/</literal> directory
	  for each pulled branch unless they are already created. Such
	  refs can be then referenced by <literal>REMOTE:BRANCH</literal> in
	  <literal>ostree</literal> subcommands (e.g. <literal>ostree log origin:exampleos/x86_64/standard</literal>).
      </para>

        <para>
	  This command can retrieve just a specific commit, or go all
	  the way to performing a full mirror of the remote
	  repository.  If no <literal>BRANCH</literal> is specified,
	  all configured branches are retrieved.
        </para>

	<para>
    A special syntax in the <literal>@</literal> character allows
    specifying a specific commit to retrieve from a branch.  The
    use cases for this are somewhat similar to pulling a specific
    git tag; one could e.g. script a system upgrade to a known-good
    version, rather than the latest from the content provider.
	</para>

    </refsect1>

    <refsect1>
        <title>Example</title>

        <para><command>$ ostree --repo=repo pull --depth=-1 --mirror remote_name</command></para>

	<para>Perform a complete mirror of the remote.  (This is
	likely most useful if your repository is also
	<literal>archive</literal> mode)</para>

        <para><command>$ ostree --repo=repo pull remote_name exampleos/x86_64/standard</command></para>

	<para>Fetch the most recent commit to <literal>exampleos/x86_64/standard</literal>.</para>

        <para><command>$ ostree --repo=repo pull remote_name exampleos/x86_64/standard@98ea6e4f216f2fb4b69fff9b3a44842c38686ca685f3f55dc48c5d3fb1107be4</command></para>

	<para>Download the specific commit starting with
	<literal>98ea6e</literal> as if it was the latest commit for
	<literal>exampleos/x86_64/standard</literal>.</para>
    </refsect1>

</refentry>
