Blame include/git2/ignore.h

Packit Service 20376f
/*
Packit Service 20376f
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit Service 20376f
 *
Packit Service 20376f
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit Service 20376f
 * a Linking Exception. For full terms see the included COPYING file.
Packit Service 20376f
 */
Packit Service 20376f
#ifndef INCLUDE_git_ignore_h__
Packit Service 20376f
#define INCLUDE_git_ignore_h__
Packit Service 20376f
Packit Service 20376f
#include "common.h"
Packit Service 20376f
#include "types.h"
Packit Service 20376f
Packit Service 20376f
GIT_BEGIN_DECL
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Add ignore rules for a repository.
Packit Service 20376f
 *
Packit Service 20376f
 * Excludesfile rules (i.e. .gitignore rules) are generally read from
Packit Service 20376f
 * .gitignore files in the repository tree or from a shared system file
Packit Service 20376f
 * only if a "core.excludesfile" config value is set.  The library also
Packit Service 20376f
 * keeps a set of per-repository internal ignores that can be configured
Packit Service 20376f
 * in-memory and will not persist.  This function allows you to add to
Packit Service 20376f
 * that internal rules list.
Packit Service 20376f
 *
Packit Service 20376f
 * Example usage:
Packit Service 20376f
 *
Packit Service 20376f
 *     error = git_ignore_add_rule(myrepo, "*.c\ndir/\nFile with space\n");
Packit Service 20376f
 *
Packit Service 20376f
 * This would add three rules to the ignores.
Packit Service 20376f
 *
Packit Service 20376f
 * @param repo The repository to add ignore rules to.
Packit Service 20376f
 * @param rules Text of rules, a la the contents of a .gitignore file.
Packit Service 20376f
 *              It is okay to have multiple rules in the text; if so,
Packit Service 20376f
 *              each rule should be terminated with a newline.
Packit Service 20376f
 * @return 0 on success
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_ignore_add_rule(
Packit Service 20376f
	git_repository *repo,
Packit Service 20376f
	const char *rules);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Clear ignore rules that were explicitly added.
Packit Service 20376f
 *
Packit Service 20376f
 * Resets to the default internal ignore rules.  This will not turn off
Packit Service 20376f
 * rules in .gitignore files that actually exist in the filesystem.
Packit Service 20376f
 *
Packit Service 20376f
 * The default internal ignores ignore ".", ".." and ".git" entries.
Packit Service 20376f
 *
Packit Service 20376f
 * @param repo The repository to remove ignore rules from.
Packit Service 20376f
 * @return 0 on success
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_ignore_clear_internal_rules(
Packit Service 20376f
	git_repository *repo);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Test if the ignore rules apply to a given path.
Packit Service 20376f
 *
Packit Service 20376f
 * This function checks the ignore rules to see if they would apply to the
Packit Service 20376f
 * given file.  This indicates if the file would be ignored regardless of
Packit Service 20376f
 * whether the file is already in the index or committed to the repository.
Packit Service 20376f
 *
Packit Service 20376f
 * One way to think of this is if you were to do "git add ." on the
Packit Service 20376f
 * directory containing the file, would it be added or not?
Packit Service 20376f
 *
Packit Service 20376f
 * @param ignored boolean returning 0 if the file is not ignored, 1 if it is
Packit Service 20376f
 * @param repo a repository object
Packit Service 20376f
 * @param path the file to check ignores for, relative to the repo's workdir.
Packit Service 20376f
 * @return 0 if ignore rules could be processed for the file (regardless
Packit Service 20376f
 *         of whether it exists or not), or an error < 0 if they could not.
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_ignore_path_is_ignored(
Packit Service 20376f
	int *ignored,
Packit Service 20376f
	git_repository *repo,
Packit Service 20376f
	const char *path);
Packit Service 20376f
Packit Service 20376f
GIT_END_DECL
Packit Service 20376f
Packit Service 20376f
#endif