Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:38

0001 /*
0002  * Copyright (C) the libgit2 contributors. All rights reserved.
0003  *
0004  * This file is part of libgit2, distributed under the GNU GPL v2 with
0005  * a Linking Exception. For full terms see the included COPYING file.
0006  */
0007 #ifndef INCLUDE_git_refdb_h__
0008 #define INCLUDE_git_refdb_h__
0009 
0010 #include "common.h"
0011 #include "types.h"
0012 #include "oid.h"
0013 #include "refs.h"
0014 
0015 /**
0016  * @file git2/refdb.h
0017  * @brief Git custom refs backend functions
0018  * @defgroup git_refdb Git custom refs backend API
0019  * @ingroup Git
0020  * @{
0021  */
0022 GIT_BEGIN_DECL
0023 
0024 /**
0025  * Create a new reference database with no backends.
0026  *
0027  * Before the Ref DB can be used for read/writing, a custom database
0028  * backend must be manually set using `git_refdb_set_backend()`
0029  *
0030  * @param out location to store the database pointer, if opened.
0031  *          Set to NULL if the open failed.
0032  * @param repo the repository
0033  * @return 0 or an error code
0034  */
0035 GIT_EXTERN(int) git_refdb_new(git_refdb **out, git_repository *repo);
0036 
0037 /**
0038  * Create a new reference database and automatically add
0039  * the default backends:
0040  *
0041  *  - git_refdb_dir: read and write loose and packed refs
0042  *      from disk, assuming the repository dir as the folder
0043  *
0044  * @param out location to store the database pointer, if opened.
0045  *          Set to NULL if the open failed.
0046  * @param repo the repository
0047  * @return 0 or an error code
0048  */
0049 GIT_EXTERN(int) git_refdb_open(git_refdb **out, git_repository *repo);
0050 
0051 /**
0052  * Suggests that the given refdb compress or optimize its references.
0053  * This mechanism is implementation specific.  For on-disk reference
0054  * databases, for example, this may pack all loose references.
0055  *
0056  * @param refdb The reference database to optimize.
0057  * @return 0 or an error code.
0058  */
0059 GIT_EXTERN(int) git_refdb_compress(git_refdb *refdb);
0060 
0061 /**
0062  * Close an open reference database.
0063  *
0064  * @param refdb reference database pointer or NULL
0065  */
0066 GIT_EXTERN(void) git_refdb_free(git_refdb *refdb);
0067 
0068 /** @} */
0069 GIT_END_DECL
0070 
0071 #endif