]>
git.proxmox.com Git - libgit2.git/blob - include/git2/refdb.h
2 * Copyright (C) the libgit2 contributors. All rights reserved.
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
7 #ifndef INCLUDE_git_refdb_h__
8 #define INCLUDE_git_refdb_h__
17 * @brief Git custom refs backend functions
18 * @defgroup git_refdb Git custom refs backend API
25 * Create a new reference database with no backends.
27 * Before the Ref DB can be used for read/writing, a custom database
28 * backend must be manually set using `git_refdb_set_backend()`
30 * @param out location to store the database pointer, if opened.
31 * Set to NULL if the open failed.
32 * @param repo the repository
33 * @return 0 or an error code
35 GIT_EXTERN(int) git_refdb_new(git_refdb
**out
, git_repository
*repo
);
38 * Create a new reference database and automatically add
39 * the default backends:
41 * - git_refdb_dir: read and write loose and packed refs
42 * from disk, assuming the repository dir as the folder
44 * @param out location to store the database pointer, if opened.
45 * Set to NULL if the open failed.
46 * @param repo the repository
47 * @return 0 or an error code
49 GIT_EXTERN(int) git_refdb_open(git_refdb
**out
, git_repository
*repo
);
52 * Suggests that the given refdb compress or optimize its references.
53 * This mechanism is implementation specific. For on-disk reference
54 * databases, for example, this may pack all loose references.
56 GIT_EXTERN(int) git_refdb_compress(git_refdb
*refdb
);
59 * Close an open reference database.
61 * @param refdb reference database pointer or NULL
63 GIT_EXTERN(void) git_refdb_free(git_refdb
*refdb
);