Back to home page

EIC code displayed by LXR

 
 

    


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

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_sys_git_midx_h__
0008 #define INCLUDE_sys_git_midx_h__
0009 
0010 #include "git2/common.h"
0011 #include "git2/types.h"
0012 
0013 /**
0014  * @file git2/midx.h
0015  * @brief Git multi-pack-index routines
0016  * @defgroup git_midx Git multi-pack-index routines
0017  * @ingroup Git
0018  * @{
0019  */
0020 GIT_BEGIN_DECL
0021 
0022 /**
0023  * Create a new writer for `multi-pack-index` files.
0024  *
0025  * @param out location to store the writer pointer.
0026  * @param pack_dir the directory where the `.pack` and `.idx` files are. The
0027  * `multi-pack-index` file will be written in this directory, too.
0028  * @return 0 or an error code
0029  */
0030 GIT_EXTERN(int) git_midx_writer_new(
0031         git_midx_writer **out,
0032         const char *pack_dir
0033 #ifdef GIT_EXPERIMENTAL_SHA256
0034         , git_oid_t oid_type
0035 #endif
0036         );
0037 
0038 /**
0039  * Free the multi-pack-index writer and its resources.
0040  *
0041  * @param w the writer to free. If NULL no action is taken.
0042  */
0043 GIT_EXTERN(void) git_midx_writer_free(git_midx_writer *w);
0044 
0045 /**
0046  * Add an `.idx` file to the writer.
0047  *
0048  * @param w the writer
0049  * @param idx_path the path of an `.idx` file.
0050  * @return 0 or an error code
0051  */
0052 GIT_EXTERN(int) git_midx_writer_add(
0053         git_midx_writer *w,
0054         const char *idx_path);
0055 
0056 /**
0057  * Write a `multi-pack-index` file to a file.
0058  *
0059  * @param w the writer
0060  * @return 0 or an error code
0061  */
0062 GIT_EXTERN(int) git_midx_writer_commit(
0063         git_midx_writer *w);
0064 
0065 /**
0066  * Dump the contents of the `multi-pack-index` to an in-memory buffer.
0067  *
0068  * @param midx Buffer where to store the contents of the `multi-pack-index`.
0069  * @param w the writer
0070  * @return 0 or an error code
0071  */
0072 GIT_EXTERN(int) git_midx_writer_dump(
0073         git_buf *midx,
0074         git_midx_writer *w);
0075 
0076 /** @} */
0077 GIT_END_DECL
0078 #endif