1 /* Copyright (c) 2006-2015 Jonas Fonseca <jonas.fonseca@gmail.com>
2  *
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.
7  *
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.
12  */
13 
14 #ifndef TIG_REPO_H
15 #define TIG_REPO_H
16 
17 #include "tig/tig.h"
18 
19 typedef char repo_ref[SIZEOF_REF];
20 typedef char repo_rev[SIZEOF_REV];
21 typedef char repo_str[SIZEOF_STR];
22 
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 	_(repo_str, worktree) \
31 	_(repo_str, exec_dir) \
32 	_(bool,     is_inside_work_tree)
33 
34 #define REPO_INFO_FIELDS(type, name)	type name;
35 
36 struct repo_info {
37 	REPO_INFO(REPO_INFO_FIELDS)
38 };
39 
40 extern struct repo_info repo;
41 
42 enum status_code load_repo_info(void);
43 enum status_code load_repo_head(void);
44 
45 struct index_diff {
46 	int staged;
47 	int unstaged;
48 	int untracked;
49 };
50 
51 bool index_diff(struct index_diff *diff, bool untracked, bool count_all);
52 bool update_index(void);
53 
54 #endif
55 /* vim: set ts=8 sw=8 noexpandtab: */
56