Beispiel #1
0
QString QGitConfig::findSystem()
{
    char buffer[GIT_PATH_MAX];
    qGitThrow( git_config_find_system(buffer, GIT_PATH_MAX) );

    return QFile::decodeName(buffer);
}
/**
 * ggit_config_find_system:
 *
 * Find the file representing the systems global git configuration. This file
 * is usually located at /etc/gitconfig on UNIX type systems or
 * %PROGRAMFILES%\Git\etc\gitconfig on windows. This function will try to guess
 * the full path to that file, if the file exists. The returned file may then
 * be used with #ggit_config_new_from_file or #ggit_config_add_file. This
 * function returns %NULL if the system config could not be found.
 *
 * Returns: (transfer full): a #GFile or %NULL if the system config could not
 *                           be found.
 *
 **/
GFile *
ggit_config_find_system (void)
{
	gchar path[GIT_PATH_MAX];

	if (git_config_find_system (path, GIT_PATH_MAX) != GIT_OK)
	{
		return NULL;
	}
	else
	{
		return g_file_new_for_path (path);
	}
}
Beispiel #3
0
PyObject *
Config_get_system_config(void)
{
    char path[GIT_PATH_MAX];
    int err;

    err = git_config_find_system(path, GIT_PATH_MAX);
    if (err < 0) {
        if (err == GIT_ENOTFOUND) {
            PyErr_SetString(PyExc_IOError, "System config file not found.");
            return NULL;
        }
        return Error_set(err);
    }

    return wrap_config(path);
}
int git_repository_config__weakptr(git_config **out, git_repository *repo)
{
	int error = 0;

	if (repo->_config == NULL) {
		git_buf global_buf = GIT_BUF_INIT;
		git_buf xdg_buf = GIT_BUF_INIT;
		git_buf system_buf = GIT_BUF_INIT;
		git_config *config;

		git_config_find_global(&global_buf);
		git_config_find_xdg(&xdg_buf);
		git_config_find_system(&system_buf);

		/* If there is no global file, open a backend for it anyway */
		if (git_buf_len(&global_buf) == 0)
			git_config__global_location(&global_buf);

		error = load_config(
			&config, repo,
			path_unless_empty(&global_buf),
			path_unless_empty(&xdg_buf),
			path_unless_empty(&system_buf));
		if (!error) {
			GIT_REFCOUNT_OWN(config, repo);

			config = (git_config*) git__compare_and_swap(&repo->_config, NULL, config);
			if (config != NULL) {
				GIT_REFCOUNT_OWN(config, NULL);
				git_config_free(config);
			}
		}

		git_buf_free(&global_buf);
		git_buf_free(&xdg_buf);
		git_buf_free(&system_buf);
	}

	*out = repo->_config;
	return error;
}
Beispiel #5
0
std::string Config::findSystem()
{
    char buffer[GIT_PATH_MAX];
    Exception::assert( git_config_find_system(buffer, GIT_PATH_MAX) );
    return std::string(buffer);
}