Line data Source code
1 : /*! 2 : * \file esys/repo/git/cloneoptions.h 3 : * \brief Options for GitBase::clone (fetch shape; tip name is separate ``rev``) 4 : * 5 : * \cond 6 : * __legal_b__ 7 : * 8 : * Copyright (c) 2026 Michel Gillet 9 : * Distributed under the MIT License. 10 : * (See accompanying file LICENSE.txt or 11 : * copy at https://opensource.org/licenses/MIT) 12 : * 13 : * __legal_e__ 14 : * \endcond 15 : * 16 : */ 17 : 18 : #pragma once 19 : 20 : #include "esys/repo/esysrepo_defs.h" 21 : 22 : //<swig_inc/> 23 : 24 : namespace esys::repo::git 25 : { 26 : 27 : /*! \class CloneOptions esys/repo/git/cloneoptions.h "esys/repo/git/cloneoptions.h" 28 : * \brief How to fetch / check out during clone (``rev`` stays a separate clone argument) 29 : * 30 : * Default-constructed options match the legacy path: clone the remote default tip 31 : * only (``rev`` ignored). The convenience ``GitBase::clone(url, path, rev)`` without 32 : * an explicit ``CloneOptions`` uses that default. 33 : */ 34 197 : struct ESYSREPO_API CloneOptions 35 : { 36 : //! Check out the tip named by ``rev`` during clone (``git clone --branch``). 37 : /*! 38 : * When false (default), backends ignore ``rev`` and clone the remote default tip; 39 : * callers that need another tip fetch/checkout afterward (legacy SyncRepo path). 40 : * When true, ``rev`` must be a branch or tag name (not a raw commit SHA). 41 : */ 42 : bool checkout_rev = false; 43 : 44 : //! Fetch only the tip named by ``rev`` (git ``--single-branch``). 45 : /*! 46 : * Only meaningful when ``checkout_rev`` is true and ``rev`` is non-empty. 47 : * When ``rev`` is empty, backends may still limit to the remote default tip 48 : * (gitcmdline) or ignore this flag (libgit2). Prefer a non-empty ``rev``. 49 : */ 50 : bool single_branch = false; 51 : }; 52 : 53 : } // namespace esys::repo::git