mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-28 03:57:37 +00:00

This create a new git_iterator type of object that provides a uniform interface for iterating over the index, an arbitrary tree, or the working directory of a repository. As part of this, git ignore support was extended to support push and pop of directory-based ignore files as the working directory is being traversed (so the array of ignores does not have to be recreated at each directory during traveral). There are a number of other small utility functions in buffer, path, vector, and fileops that are included in this patch that made the iterator implementation cleaner.
38 lines
1.1 KiB
C
38 lines
1.1 KiB
C
/*
|
|
* Copyright (C) 2009-2012 the libgit2 contributors
|
|
*
|
|
* 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_ignore_h__
|
|
#define INCLUDE_ignore_h__
|
|
|
|
#include "repository.h"
|
|
#include "vector.h"
|
|
|
|
/* The git_ignores structure maintains three sets of ignores:
|
|
* - internal ignores
|
|
* - per directory ignores
|
|
* - global ignores (at lower priority than the others)
|
|
* As you traverse from one directory to another, you can push and pop
|
|
* directories onto git_ignores list efficiently.
|
|
*/
|
|
typedef struct {
|
|
git_repository *repo;
|
|
git_buf dir;
|
|
git_attr_file *ign_internal;
|
|
git_vector ign_path;
|
|
git_vector ign_global;
|
|
} git_ignores;
|
|
|
|
extern int git_ignore__for_path(
|
|
git_repository *repo, const char *path, git_ignores *ign);
|
|
|
|
extern int git_ignore__push_dir(git_ignores *ign, const char *dir);
|
|
extern int git_ignore__pop_dir(git_ignores *ign);
|
|
|
|
extern void git_ignore__free(git_ignores *ign);
|
|
extern int git_ignore__lookup(git_ignores *ign, const char *path, int *ignored);
|
|
|
|
#endif
|