Hash :
c63793ee
Author :
Date :
2012-03-02T03:51:45
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
/*
* 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_git_attr_h__
#define INCLUDE_git_attr_h__
#include "common.h"
#include "types.h"
/**
* @file git2/attr.h
* @brief Git attribute management routines
* @defgroup git_attr Git attribute management routines
* @ingroup Git
* @{
*/
GIT_BEGIN_DECL
#define GIT_ATTR_TRUE(attr) ((attr) == git_attr__true)
#define GIT_ATTR_FALSE(attr) ((attr) == git_attr__false)
#define GIT_ATTR_UNSPECIFIED(attr) ((attr) == NULL)
GIT_EXTERN(const char *) git_attr__true;
GIT_EXTERN(const char *) git_attr__false;
/**
* Lookup attribute for path returning string caller must free
*/
GIT_EXTERN(int) git_attr_get(
git_repository *repo, const char *path, const char *name,
const char **value);
/**
* Lookup list of attributes for path, populating array of strings
*/
GIT_EXTERN(int) git_attr_get_many(
git_repository *repo, const char *path,
size_t num_attr, const char **names,
const char **values);
/**
* Perform an operation on each attribute of a path.
*/
GIT_EXTERN(int) git_attr_foreach(
git_repository *repo, const char *path,
int (*callback)(const char *name, const char *value, void *payload),
void *payload);
/**
* Flush the gitattributes cache.
*
* Call this if you have reason to believe that the attributes files
* on disk no longer match the cached contents of memory.
*/
GIT_EXTERN(void) git_attr_cache_flush(
git_repository *repo);
/**
* Add a macro definition.
*
* Macros will automatically be loaded from the top level .gitattributes
* file of the repository (plus the build-in "binary" macro). This
* function allows you to add others. For example, to add the default
* macro, you would call:
*
* git_attr_add_macro(repo, "binary", "-diff -crlf");
*/
GIT_EXTERN(int) git_attr_add_macro(
git_repository *repo,
const char *name,
const char *values);
/** @} */
GIT_END_DECL
#endif