Add support for GIT_CEILING_DIRS
PATCH 1/1 Add support for GIT_CEILING_DIRS
Quoted 1 line
From
f29e8a524f770596450dbbe338433f0dfc365377Mon Sep 17 00:00:00 2001
From: David Reiss <[email protected]>
Date: Sun, 20 Apr 2008 12:27:52 -0700
Subject: [PATCH] chdir after computing new cwd in check_repository_format_gently
In preparation for adding a check before the chdir. This should be a no-op because the cwd is not read in the interim and any nonlocal exits either chdir to an absolute path or die.
--- setup.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
setup.c +1 -1
@@ -396,7 +396,6 @@ const char *setup_git_directory_gently(int *nongit_ok)check_repository_format_gently (nongit_ok);return NULL ; } -chdir (".." ); do { if (!offset) { if (nongit_ok) {
@@ -408,6 +407,7 @@ const char *setup_git_directory_gently(int *nongit_ok)die ("Not a git repository" ); } }while (cwd[--offset] !='/' ); +chdir (".." ); } inside_git_dir =0 ;
Signature · 1 line
1.5.4
Quoted 1 line
From
1543c81e75e7890475331bbae1de98ead45e5245Mon Sep 17 00:00:00 2001
From: David Reiss <[email protected]>
Date: Sun, 20 Apr 2008 22:54:11 -0700
Subject: [PATCH] Add support for GIT_CEILING_DIRS
Make git recognize a new environment variable that prevents it from chdir'ing up into specified directories when looking for a GIT_DIR. Useful for avoiding slow network directories.
---
Just a bit of context about the motivation for this. I use git in an environment where homedirs are automounted and "ls /home/nonexistent" takes about 9 seconds. I use the git bash completion, which runs "git help -a". As of Git 1.5.5, this calls setup_git_directory_gently, which searches /home/.git and /home/objects, which takes forever, delaying all of my logins. This patch lets me set "GIT_CEILING_DIRS=/home", which makes this operation fast. As a bonus, the "git symbolic-ref HEAD" in my shell prompt now works quickly when I'm in a non-git directory.
Documentation/git.txt | 8 ++++ cache.h | 1 + setup.c | 67 +++++++++++++++++++++++++----- t/t1503-ceiling-dirs.sh | 104 +++++++++++++++++++++++++++++++++++++++++++++++ t/test-lib.sh | 1 + 5 files changed, 170 insertions(+), 11 deletions(-) create mode 100755 t/t1503-ceiling-dirs.sh
Documentation/git.txt +8 -0
@@ -406,6 +406,14 @@ git so take care if using Cogito etc. This can also be controlled by the '--work-tree' command line option and the core.worktree configuration variable. +'GIT_CEILING_DIRS':: + This should be a colon-separated list of absolute paths. + If set, it is a list of directories that git should not chdir + up into while looking for a repository directory. + It will not exclude the current working directory or + a GIT_DIR set on the command line or in the environment. + (Useful for excluding slow-loading network directories.) + git Commits ~~~~~~~~~~~ 'GIT_AUTHOR_NAME'::
cache.h +1 -0
@@ -295,6 +295,7 @@ static inline enum object_type object_type(unsigned int mode)#define CONFIG_ENVIRONMENT "GIT_CONFIG"#define CONFIG_LOCAL_ENVIRONMENT "GIT_CONFIG_LOCAL"#define EXEC_PATH_ENVIRONMENT "GIT_EXEC_PATH" +#define CEILING_DIRS_ENVIRONMENT "GIT_CEILING_DIRS"#define GITATTRIBUTES_FILE ".gitattributes"#define INFOATTRIBUTES_FILE "info/attributes"#define ATTRIBUTE_MACRO_PREFIX "[attr]"
setup.c +56 -11
94 lines not on this page · raw message
t/t1503-ceiling-dirs.sh new file +104 -0
104 lines not on this page · raw message
t/test-lib.sh +1 -0
@@ -35,6 +35,7 @@ unset GIT_WORK_TREE unset GIT_EXTERNAL_DIFF unset GIT_INDEX_FILE unset GIT_OBJECT_DIRECTORY +unset GIT_CEILING_DIRS unset SHA1_FILE_DIRECTORIES unset SHA1_FILE_DIRECTORY GIT_MERGE_VERBOSITY=5
Signature · 1 line
1.5.4