mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-01 23:50:11 +00:00
Move some low-level repo fns to include/git2/sys
This commit is contained in:
parent
7cc3c92027
commit
1384b688d0
@ -136,14 +136,6 @@ GIT_EXTERN(int) git_repository_open_ext(
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_open_bare(git_repository **out, const char *bare_path);
|
||||
|
||||
/**
|
||||
* Create a new repository with neither backends nor config object
|
||||
*
|
||||
* Note that this is only useful if you wish to associate the repository
|
||||
* with a non-filesystem-backed object database and config store.
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_new(git_repository **out);
|
||||
|
||||
/**
|
||||
* Free a previously allocated repository
|
||||
*
|
||||
@ -408,21 +400,6 @@ GIT_EXTERN(int) git_repository_is_bare(git_repository *repo);
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_config(git_config **out, git_repository *repo);
|
||||
|
||||
/**
|
||||
* Set the configuration file for this repository
|
||||
*
|
||||
* This configuration file will be used for all configuration
|
||||
* queries involving this repository.
|
||||
*
|
||||
* The repository will keep a reference to the config file;
|
||||
* the user must still free the config after setting it
|
||||
* to the repository, or it will leak.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param config A Config object
|
||||
*/
|
||||
GIT_EXTERN(void) git_repository_set_config(git_repository *repo, git_config *config);
|
||||
|
||||
/**
|
||||
* Get the Object Database for this repository.
|
||||
*
|
||||
@ -439,21 +416,6 @@ GIT_EXTERN(void) git_repository_set_config(git_repository *repo, git_config *con
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_odb(git_odb **out, git_repository *repo);
|
||||
|
||||
/**
|
||||
* Set the Object Database for this repository
|
||||
*
|
||||
* The ODB will be used for all object-related operations
|
||||
* involving this repository.
|
||||
*
|
||||
* The repository will keep a reference to the ODB; the user
|
||||
* must still free the ODB object after setting it to the
|
||||
* repository, or it will leak.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param odb An ODB object
|
||||
*/
|
||||
GIT_EXTERN(void) git_repository_set_odb(git_repository *repo, git_odb *odb);
|
||||
|
||||
/**
|
||||
* Get the Reference Database Backend for this repository.
|
||||
*
|
||||
@ -470,23 +432,6 @@ GIT_EXTERN(void) git_repository_set_odb(git_repository *repo, git_odb *odb);
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_refdb(git_refdb **out, git_repository *repo);
|
||||
|
||||
/**
|
||||
* Set the Reference Database Backend for this repository
|
||||
*
|
||||
* The refdb will be used for all reference related operations
|
||||
* involving this repository.
|
||||
*
|
||||
* The repository will keep a reference to the refdb; the user
|
||||
* must still free the refdb object after setting it to the
|
||||
* repository, or it will leak.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param refdb An refdb object
|
||||
*/
|
||||
GIT_EXTERN(void) git_repository_set_refdb(
|
||||
git_repository *repo,
|
||||
git_refdb *refdb);
|
||||
|
||||
/**
|
||||
* Get the Index file for this repository.
|
||||
*
|
||||
@ -503,21 +448,6 @@ GIT_EXTERN(void) git_repository_set_refdb(
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_index(git_index **out, git_repository *repo);
|
||||
|
||||
/**
|
||||
* Set the index file for this repository
|
||||
*
|
||||
* This index will be used for all index-related operations
|
||||
* involving this repository.
|
||||
*
|
||||
* The repository will keep a reference to the index file;
|
||||
* the user must still free the index after setting it
|
||||
* to the repository, or it will leak.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param index An index object
|
||||
*/
|
||||
GIT_EXTERN(void) git_repository_set_index(git_repository *repo, git_index *index);
|
||||
|
||||
/**
|
||||
* Retrieve git's prepared message
|
||||
*
|
||||
|
92
include/git2/sys/repository.h
Normal file
92
include/git2/sys/repository.h
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_sys_git_repository_h__
|
||||
#define INCLUDE_sys_git_repository_h__
|
||||
|
||||
/**
|
||||
* @file git2/sys/repository.h
|
||||
* @brief Git repository custom implementation routines
|
||||
* @defgroup git_backend Git custom backend APIs
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Create a new repository with neither backends nor config object
|
||||
*
|
||||
* Note that this is only useful if you wish to associate the repository
|
||||
* with a non-filesystem-backed object database and config store.
|
||||
*
|
||||
* @param out The blank repository
|
||||
* @return 0 on success, or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_new(git_repository **out);
|
||||
|
||||
/**
|
||||
* Set the configuration file for this repository
|
||||
*
|
||||
* This configuration file will be used for all configuration
|
||||
* queries involving this repository.
|
||||
*
|
||||
* The repository will keep a reference to the config file;
|
||||
* the user must still free the config after setting it
|
||||
* to the repository, or it will leak.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param config A Config object
|
||||
*/
|
||||
GIT_EXTERN(void) git_repository_set_config(git_repository *repo, git_config *config);
|
||||
|
||||
/**
|
||||
* Set the Object Database for this repository
|
||||
*
|
||||
* The ODB will be used for all object-related operations
|
||||
* involving this repository.
|
||||
*
|
||||
* The repository will keep a reference to the ODB; the user
|
||||
* must still free the ODB object after setting it to the
|
||||
* repository, or it will leak.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param odb An ODB object
|
||||
*/
|
||||
GIT_EXTERN(void) git_repository_set_odb(git_repository *repo, git_odb *odb);
|
||||
|
||||
/**
|
||||
* Set the Reference Database Backend for this repository
|
||||
*
|
||||
* The refdb will be used for all reference related operations
|
||||
* involving this repository.
|
||||
*
|
||||
* The repository will keep a reference to the refdb; the user
|
||||
* must still free the refdb object after setting it to the
|
||||
* repository, or it will leak.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param refdb An refdb object
|
||||
*/
|
||||
GIT_EXTERN(void) git_repository_set_refdb(git_repository *repo, git_refdb *refdb);
|
||||
|
||||
/**
|
||||
* Set the index file for this repository
|
||||
*
|
||||
* This index will be used for all index-related operations
|
||||
* involving this repository.
|
||||
*
|
||||
* The repository will keep a reference to the index file;
|
||||
* the user must still free the index after setting it
|
||||
* to the repository, or it will leak.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param index An index object
|
||||
*/
|
||||
GIT_EXTERN(void) git_repository_set_index(git_repository *repo, git_index *index);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "git2/object.h"
|
||||
#include "git2/refdb.h"
|
||||
#include "git2/sys/repository.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "repository.h"
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "clar_libgit2.h"
|
||||
#include "git2/sys/repository.h"
|
||||
|
||||
#include "diff_helpers.h"
|
||||
#include "repository.h"
|
||||
#include "buf_text.h"
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "clar_libgit2.h"
|
||||
#include "git2/sys/repository.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "posix.h"
|
||||
#include "util.h"
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "clar_libgit2.h"
|
||||
#include "git2/sys/repository.h"
|
||||
|
||||
#include "fileops.h"
|
||||
#include "ignore.h"
|
||||
#include "status_helpers.h"
|
||||
@ -321,10 +323,10 @@ void test_status_worktree_init__new_staged_file_must_handle_crlf(void)
|
||||
cl_set_cleanup(&cleanup_new_repo, "getting_started");
|
||||
cl_git_pass(git_repository_init(&repo, "getting_started", 0));
|
||||
|
||||
// Ensure that repo has core.autocrlf=true
|
||||
/* Ensure that repo has core.autocrlf=true */
|
||||
cl_repo_set_bool(repo, "core.autocrlf", true);
|
||||
|
||||
cl_git_mkfile("getting_started/testfile.txt", "content\r\n"); // Content with CRLF
|
||||
cl_git_mkfile("getting_started/testfile.txt", "content\r\n"); /* Content with CRLF */
|
||||
|
||||
cl_git_pass(git_repository_index(&index, repo));
|
||||
cl_git_pass(git_index_add_bypath(index, "testfile.txt"));
|
||||
|
Loading…
Reference in New Issue
Block a user