@matheusbsbs / matheus-bagliano / commits / e640551773
Fork 0

GIT_ONE_FILESYSTEM: flip the default to stop at filesystem boundaries

Regarding the new environment variable, Linus Torvalds <torvalds@linux-foundation.org> writes on Tue, 30 Mar 2010 in <alpine.LFD.2.00.1003301537150.3707@i5.linux-foundation.org>: I suspect that it is _very_ unusual to have a source repo that crosses multiple filesystems, and the original reason for this patch-series seems to me to be likely to be more common than that multi-fs case. So having the logic go the other way would seem to match the common case, no? The "crossing filesystem boundary" condition is checked by comparing st_dev field in the result from stat(2). This is slightly worrysome if non-POSIX ports return different values in the field even for directories in the same work tree extracted to the same "filesystem". Erik Faye-Lund confirms that in the msysgit port st_dev is 0, so this should be safe, as "even Windows is safe" ;-) This will affect those who use /.git to cram /etc and /home/me in the same repostiory, /home is mounted from non-root filesystem, and a git operation is done from inside /home/me/src. But that is such a corner case we don't want to give preference over helping people who will benefit from having this default so that they do not have to suffer from slow automounters. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Apr 4, 2010 at 10:33 UTC e640551773c9730a47779dfc93155feb092c8e3c
2 files changed +10 -6
Documentation/git.txt
+8 -4
@@ -531,10 +531,14 @@ git so take care if using Cogito etc.
531 (Useful for excluding slow-loading network directories.)
532
533 'GIT_ONE_FILESYSTEM'::
534 - If set to a true value ("true" or a non-zero integer), stop at
535 - filesystem boundaries when looking for a repository directory.
536 - Like 'GIT_CEILING_DIRECTORIES', it will not affect an explicit
537 - respository directory set via 'GIT_DIR' or on the command line.
534 + When run in a directory that does not have ".git" repository
535 + directory, git tries to find such a directory in the parent
536 + directories to find the top of the working tree, but by default it
537 + does not cross filesystem boundaries. This environment variable
538 + can be set to false value ("false" or zero) to tell git not to
539 + stop at filesystem boundaries. Like 'GIT_CEILING_DIRECTORIES',
540 + this will not affect an explicit respository directory set via
541 + 'GIT_DIR' or on the command line.
542
543 git Commits
544 ~~~~~~~~~~~
setup.c
+2 -2
@@ -323,7 +323,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
323 const char *gitdirenv;
324 const char *gitfile_dir;
325 int len, offset, ceil_offset, root_len;
326 - int current_device = 0, one_filesystem = 0;
326 + int current_device = 0, one_filesystem = 1;
327 struct stat buf;
328
329 /*
@@ -444,7 +444,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
444 }
445 cwd[offset] = '\0';
446 die("Not a git repository (or any parent up to mount parent %s)\n"
447 - "Stopping at filesystem boundary since GIT_ONE_FILESYSTEM is set.", cwd);
447 + "Stopping at filesystem boundary since GIT_ONE_FILESYSTEM is true.", cwd);
448 }
449 }
450 if (chdir("..")) {