mirror of
https://github.com/git/git.git
synced 2024-11-02 07:17:58 +01:00
4ce742fc9c
These test helper programs access the index, but do not ever setup_git_directory(), meaning we just blindly looked in ".git/index". This happened to work for the purposes of our tests (which do not run from subdirectories, nor in non-repos), but it's a bad habit. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 lines
420 B
C
18 lines
420 B
C
#include "cache.h"
|
|
#include "lockfile.h"
|
|
#include "tree.h"
|
|
#include "cache-tree.h"
|
|
|
|
static struct lock_file index_lock;
|
|
|
|
int cmd_main(int ac, const char **av)
|
|
{
|
|
setup_git_directory();
|
|
hold_locked_index(&index_lock, 1);
|
|
if (read_cache() < 0)
|
|
die("unable to read index file");
|
|
active_cache_tree = NULL;
|
|
if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
|
|
die("unable to write index file");
|
|
return 0;
|
|
}
|