Expose repository variables to external commands
[tig.git] / include / tig / repo.h
blobf227b1b39579ca13b57dff22c8991ad44273f8ba
1 /* Copyright (c) 2006-2015 Jonas Fonseca <jonas.fonseca@gmail.com>
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of
6 * the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #ifndef TIG_REPO_H
15 #define TIG_REPO_H
17 #include "tig/tig.h"
19 typedef char repo_ref[SIZEOF_REF];
20 typedef char repo_rev[SIZEOF_REV];
21 typedef char repo_str[SIZEOF_STR];
23 #define REPO_INFO(_) \
24 _(repo_ref, head) \
25 _(repo_rev, head_id) \
26 _(repo_ref, remote) \
27 _(repo_str, cdup) \
28 _(repo_str, prefix) \
29 _(repo_str, git_dir) \
30 _(bool, is_inside_work_tree)
32 #define REPO_INFO_FIELDS(type, name) type name;
34 struct repo_info {
35 REPO_INFO(REPO_INFO_FIELDS)
38 extern struct repo_info repo;
40 enum status_code load_repo_info(void);
41 enum status_code load_repo_head(void);
43 struct index_diff {
44 int staged;
45 int unstaged;
46 int untracked;
49 bool index_diff(struct index_diff *diff, bool untracked, bool count_all);
50 bool update_index(void);
52 #endif
53 /* vim: set ts=8 sw=8 noexpandtab: */