diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-07-29 08:48:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 08:48:17 -0400 |
commit | 003a1df6540c9f24042e496b64b87223dff29cf0 (patch) | |
tree | 7faabe8ab3dcaeddc0686d305b41c9200dd35b6e /src/attr_file.h | |
parent | f313b3834be2dcb60c9dccd118686f0043153a2c (diff) | |
parent | 1439b9ff05524949b6b3fa6cad716a9bb3cbc249 (diff) | |
download | libgit2-003a1df6540c9f24042e496b64b87223dff29cf0.tar.gz |
Merge pull request #5952 from libgit2/ethomson/attrs_from_commit
Support reading attributes from a specific commit
Diffstat (limited to 'src/attr_file.h')
-rw-r--r-- | src/attr_file.h | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/attr_file.h b/src/attr_file.h index 617436b14..16e33caf1 100644 --- a/src/attr_file.h +++ b/src/attr_file.h @@ -37,12 +37,30 @@ (GIT_ATTR_FNMATCH_ALLOWSPACE | GIT_ATTR_FNMATCH_ALLOWNEG | GIT_ATTR_FNMATCH_ALLOWMACRO) typedef enum { - GIT_ATTR_FILE__IN_MEMORY = 0, - GIT_ATTR_FILE__FROM_FILE = 1, - GIT_ATTR_FILE__FROM_INDEX = 2, - GIT_ATTR_FILE__FROM_HEAD = 3, + GIT_ATTR_FILE_SOURCE_MEMORY = 0, + GIT_ATTR_FILE_SOURCE_FILE = 1, + GIT_ATTR_FILE_SOURCE_INDEX = 2, + GIT_ATTR_FILE_SOURCE_COMMIT = 3, - GIT_ATTR_FILE_NUM_SOURCES = 4 + GIT_ATTR_FILE_NUM_SOURCES = 4 +} git_attr_file_source_t; + +typedef struct { + /* The source location for the attribute file. */ + git_attr_file_source_t type; + + /* + * The filename of the attribute file to read (relative to the + * given base path). + */ + const char *base; + const char *filename; + + /* + * The commit ID when the given source type is a commit (or NULL + * for the repository's HEAD commit.) + */ + git_oid *commit_id; } git_attr_file_source; extern const char *git_attr__true; @@ -124,7 +142,7 @@ extern int git_attr_get_many_with_session( const char **values_out, git_repository *repo, git_attr_session *attr_session, - uint32_t flags, + git_attr_options *opts, const char *path, size_t num_attr, const char **names); @@ -142,7 +160,7 @@ typedef int (*git_attr_file_parser)( int git_attr_file__new( git_attr_file **out, git_attr_file_entry *entry, - git_attr_file_source source); + git_attr_file_source *source); void git_attr_file__free(git_attr_file *file); @@ -151,7 +169,7 @@ int git_attr_file__load( git_repository *repo, git_attr_session *attr_session, git_attr_file_entry *ce, - git_attr_file_source source, + git_attr_file_source *source, git_attr_file_parser parser, bool allow_macros); @@ -159,7 +177,7 @@ int git_attr_file__load_standalone( git_attr_file **out, const char *path); int git_attr_file__out_of_date( - git_repository *repo, git_attr_session *session, git_attr_file *file); + git_repository *repo, git_attr_session *session, git_attr_file *file, git_attr_file_source *source); int git_attr_file__parse_buffer( git_repository *repo, git_attr_file *attrs, const char *data, bool allow_macros); |