Thomas Rast | 1aed2fe | 2011-12-06 18:43:35 +0100 | [diff] [blame] | 1 | #include "cache.h" |
Michael Haggerty | 697cc8e | 2014-10-01 12:28:42 +0200 | [diff] [blame] | 2 | #include "lockfile.h" |
Thomas Rast | 1aed2fe | 2011-12-06 18:43:35 +0100 | [diff] [blame] | 3 | #include "tree.h" |
| 4 | #include "cache-tree.h" |
| 5 | |
| 6 | static struct lock_file index_lock; |
| 7 | |
Jeff King | 3f2e229 | 2016-07-01 01:58:58 -0400 | [diff] [blame] | 8 | int cmd_main(int ac, const char **av) |
Thomas Rast | 1aed2fe | 2011-12-06 18:43:35 +0100 | [diff] [blame] | 9 | { |
Jeff King | 4ce742f | 2016-10-20 02:16:59 -0400 | [diff] [blame] | 10 | setup_git_directory(); |
Junio C Hamano | b3e83cc | 2016-12-07 10:33:54 -0800 | [diff] [blame] | 11 | hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR); |
Thomas Rast | 1aed2fe | 2011-12-06 18:43:35 +0100 | [diff] [blame] | 12 | if (read_cache() < 0) |
| 13 | die("unable to read index file"); |
| 14 | active_cache_tree = NULL; |
Nguyễn Thái Ngọc Duy | 03b8664 | 2014-06-13 19:19:23 +0700 | [diff] [blame] | 15 | if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK)) |
Thomas Rast | 1aed2fe | 2011-12-06 18:43:35 +0100 | [diff] [blame] | 16 | die("unable to write index file"); |
| 17 | return 0; |
| 18 | } |