config.h 1.41 KB
Newer Older
Vicent Marti committed
1
/*
schu committed
2
 * Copyright (C) 2009-2012 the libgit2 contributors
Vicent Marti committed
3 4 5 6
 *
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 * a Linking Exception. For full terms see the included COPYING file.
 */
7 8 9
#ifndef INCLUDE_config_h__
#define INCLUDE_config_h__

10
#include "git2.h"
11
#include "git2/config.h"
12
#include "vector.h"
13
#include "repository.h"
14

15
#define GIT_CONFIG_FILENAME ".gitconfig"
16
#define GIT_CONFIG_FILENAME_ALT ".config/git/config"
17
#define GIT_CONFIG_FILENAME_INREPO "config"
18
#define GIT_CONFIG_FILENAME_SYSTEM "gitconfig"
19
#define GIT_CONFIG_FILE_MODE 0666
20

21
struct git_config {
22
	git_refcount rc;
23
	git_vector files;
24 25
};

26
extern int git_config_find_global_r(git_buf *global_config_path);
Sven Strickroth committed
27
extern int git_config_find_xdg_r(git_buf *system_config_path);
28 29
extern int git_config_find_system_r(git_buf *system_config_path);

30 31 32 33 34
extern int git_config_rename_section(
	git_repository *repo,
	const char *old_section_name,	/* eg "branch.dummy" */
	const char *new_section_name);	/* NULL to drop the old section */

35 36 37 38 39 40 41 42 43 44 45
/**
 * Create a configuration file backend for ondisk files
 *
 * These are the normal `.gitconfig` files that Core Git
 * processes. Note that you first have to add this file to a
 * configuration object before you can query it for configuration
 * variables.
 *
 * @param out the new backend
 * @param path where the config file is located
 */
Ben Straub committed
46
extern int git_config_file__ondisk(struct git_config_backend **out, const char *path);
47

48
#endif