Code

git wrapper: allow setup_git_directory_gently() be called earlier
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 6 Aug 2010 02:52:16 +0000 (21:52 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Aug 2010 16:24:01 +0000 (09:24 -0700)
commitee38dfb89ef88a3e4e6818b7cfe31d122a1c640d
treeb11ac9dc2cba09c86de90a996524a98661ae2c72
parenta60645f9c54c3050cbe25882feba9d5b3d1ca0d6
git wrapper: allow setup_git_directory_gently() be called earlier

In the spirit of v1.4.2-rc3~34^2^2 (Call setup_git_directory() much
earlier, 2006-07-28), let run_builtin() take care of searching for a
repository for built-ins that want to make use of one if present.

So now you can mark your command with RUN_SETUP_GENTLY and use

nongit = !startup_info->have_repository;

in place of

prefix = setup_git_directory_gently(&nongit);

and everything will be the same, except the repository is
discovered a little sooner.

As v1.7.2~16^2 (2010-07-14) explains, this should allow more commands
to robustly use features like "git --paginate" that look at local
configuration before the command is actually run.

This patch sets up the infrastructure.  Later patches will teach
particular commands to use it.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git.c