{"thread":{"id":"13508","subject":"[PATCH 2/2] Add support for GIT_CEILING_DIRS","startedAt":"2008-05-14T05:46:08Z","lastAt":"2008-05-14T17:07:50Z","messageCount":6,"participants":["David Reiss","Johannes Schindelin","Johannes Sixt","Kevin Ballard"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"76917","messageId":"482A7CA0.9060908@facebook.com","threadId":"13508","inReplyTo":null,"subject":"[PATCH 2/2] Add support for GIT_CEILING_DIRS","fromName":"David Reiss","fromEmail":"dreiss@facebook.com","sentAt":"2008-05-14T05:46:08Z","receivedAt":"2008-05-14T05:46:08Z","isPatch":true,"sender":{"key":"dreiss@facebook.com","avatar":null},"body":"Make git recognize a new environment variable that prevents it from\nchdir'ing up into specified directories when looking for a GIT_DIR.\nUseful for avoiding slow network directories.\n\nSigned-off-by: David Reiss <dreiss@facebook.com>\n---\nJust a bit of context about the motivation for this.  I use git in an\nenvironment where homedirs are automounted and \"ls /home/nonexistent\"\ntakes about 9 seconds.  I use the git bash completion, which runs\n\"git help -a\".  As of Git 1.5.5, this calls setup_git_directory_gently,\nwhich searches /home/.git and /home/objects, which takes forever,\ndelaying all of my logins.  This patch lets me set\n\"GIT_CEILING_DIRS=/home\", which makes this operation fast.  As a bonus,\nthe \"git symbolic-ref HEAD\" in my shell prompt now works quickly when\nI'm in a non-git directory.\n\n Documentation/git.txt   |    8 ++++\n cache.h                 |    1 +\n setup.c                 |   67 +++++++++++++++++++++++++-----\n t/t1504-ceiling-dirs.sh |  104 +++++++++++++++++++++++++++++++++++++++++++++++\n t/test-lib.sh           |    1 +\n 5 files changed, 170 insertions(+), 11 deletions(-)\n create mode 100755 t/t1504-ceiling-dirs.sh\n\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex 6f445b1..8aea331 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -415,6 +415,14 @@ git so take care if using Cogito etc.\n \tThis can also be controlled by the '--work-tree' command line\n \toption and the core.worktree configuration variable.\n \n+'GIT_CEILING_DIRS'::\n+\tThis should be a colon-separated list of absolute paths.\n+\tIf set, it is a list of directories that git should not chdir\n+\tup into while looking for a repository directory.\n+\tIt will not exclude the current working directory or\n+\ta GIT_DIR set on the command line or in the environment.\n+\t(Useful for excluding slow-loading network directories.)\n+\n git Commits\n ~~~~~~~~~~~\n 'GIT_AUTHOR_NAME'::\ndiff --git a/cache.h b/cache.h\nindex 9cee9a5..8300acc 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -300,6 +300,7 @@ static inline enum object_type object_type(unsigned int mode)\n #define CONFIG_ENVIRONMENT \"GIT_CONFIG\"\n #define CONFIG_LOCAL_ENVIRONMENT \"GIT_CONFIG_LOCAL\"\n #define EXEC_PATH_ENVIRONMENT \"GIT_EXEC_PATH\"\n+#define CEILING_DIRS_ENVIRONMENT \"GIT_CEILING_DIRS\"\n #define GITATTRIBUTES_FILE \".gitattributes\"\n #define INFOATTRIBUTES_FILE \"info/attributes\"\n #define ATTRIBUTE_MACRO_PREFIX \"[attr]\"\ndiff --git a/setup.c b/setup.c\nindex c54f2b6..d7d986c 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -359,10 +359,11 @@ const char *read_gitfile_gently(const char *path)\n const char *setup_git_directory_gently(int *nongit_ok)\n {\n \tconst char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);\n+\tconst char *env_ceiling_dirs = getenv(CEILING_DIRS_ENVIRONMENT);\n \tstatic char cwd[PATH_MAX+1];\n \tconst char *gitdirenv;\n \tconst char *gitfile_dir;\n-\tint len, offset;\n+\tint len, offset, min_offset = -1;\n \n \t/*\n \t * Let's assume that we are in a git repository.\n@@ -414,6 +415,37 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \tif (!getcwd(cwd, sizeof(cwd)-1))\n \t\tdie(\"Unable to read current working directory\");\n \n+\t// Compute min_offset based on GIT_CEILING_DIRS.\n+\tif (env_ceiling_dirs) {\n+\t\tchar *ceils, *ceil, *colon;\n+\t\tceil = ceils = xstrdup(env_ceiling_dirs);\n+\t\tfor (;;) {\n+\t\t\tint len;\n+\n+\t\t\tif ((colon = strchr(ceil, ':')))\n+\t\t\t\t*colon = '\\0';\n+\t\t\tlen = strlen(ceil);\n+\n+\t\t\t// \"\" would otherwise be treated like \"/\".\n+\t\t\tif (len) {\n+\t\t\t\t// Trim trailing slashes.\n+\t\t\t\twhile (len && ceil[len-1] == '/')\n+\t\t\t\t\tceil[--len] = '\\0';\n+\n+\t\t\t\tif (!strncmp(cwd, ceil, len) &&\n+\t\t\t\t    cwd[len] == '/' &&\n+\t\t\t\t    len > min_offset) {\n+\t\t\t\t\tmin_offset = len;\n+\t\t\t\t}\n+\t\t\t}\n+\n+\t\t\tif (!colon)\n+\t\t\t\tbreak;\n+\t\t\tceil = colon + 1;\n+\t\t}\n+\t\tfree(ceils);\n+\t}\n+\n \t/*\n \t * Test in the following order (relative to the cwd):\n \t * - .git (file containing \"gitdir: <path>\")\n@@ -427,6 +459,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t */\n \toffset = len = strlen(cwd);\n \tfor (;;) {\n+\t\t// Check the current directory (.git first).\n \t\tgitfile_dir = read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);\n \t\tif (gitfile_dir) {\n \t\t\tif (set_git_dir(gitfile_dir))\n@@ -443,17 +476,29 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t\t\tcheck_repository_format_gently(nongit_ok);\n \t\t\treturn NULL;\n \t\t}\n-\t\tdo {\n-\t\t\tif (!offset) {\n-\t\t\t\tif (nongit_ok) {\n-\t\t\t\t\tif (chdir(cwd))\n-\t\t\t\t\t\tdie(\"Cannot come back to cwd\");\n-\t\t\t\t\t*nongit_ok = 1;\n-\t\t\t\t\treturn NULL;\n-\t\t\t\t}\n-\t\t\t\tdie(\"Not a git repository\");\n+\n+\t\t// Did we just check the root dir?\n+\t\tif (!offset) {\n+\t\tnot_a_repo:\n+\t\t\tif (nongit_ok) {\n+\t\t\t\tif (chdir(cwd))\n+\t\t\t\t\tdie(\"Cannot come back to cwd\");\n+\t\t\t\t*nongit_ok = 1;\n+\t\t\t\treturn NULL;\n \t\t\t}\n-\t\t} while (cwd[--offset] != '/');\n+\t\t\tdie(\"Not a git repository\");\n+\t\t}\n+\n+\t\twhile (cwd[--offset] != '/') {\n+\t\t\tassert(offset > 0);\n+\t\t}\n+\n+\t\t// Don't chdir into the ceiling.\n+\t\tif (offset <= min_offset) {\n+\t\t\tassert(offset == min_offset);\n+\t\t\tgoto not_a_repo;\n+\t\t}\n+\n \t\tchdir(\"..\");\n \t}\n \ndiff --git a/t/t1504-ceiling-dirs.sh b/t/t1504-ceiling-dirs.sh\nnew file mode 100755\nindex 0000000..d4eaa13\n--- /dev/null\n+++ b/t/t1504-ceiling-dirs.sh\n@@ -0,0 +1,104 @@\n+#!/bin/sh\n+\n+test_description='test GIT_CEILING_DIRS'\n+. ./test-lib.sh\n+\n+test_prefix() {\n+\ttest_expect_success \"$1\" \\\n+\t\"test '$2' = \\\"\\$(git rev-parse --show-prefix)\\\"\"\n+\tshift\n+\t[ $# -eq 0 ] && return\n+}\n+\n+test_fail() {\n+\ttest_expect_code 128 \"$1: prefix\" \\\n+\t\"git rev-parse --show-prefix\"\n+\tshift\n+\t[ $# -eq 0 ] && return\n+}\n+\n+TRASH_ROOT=\"$(pwd)\"\n+ROOT_PARENT=$(dirname \"$TRASH_ROOT\")\n+\n+\n+unset GIT_CEILING_DIRS\n+test_prefix no_ceil \"\"\n+\n+export GIT_CEILING_DIRS=\"\"\n+test_prefix ceil_empty \"\"\n+\n+export GIT_CEILING_DIRS=\"$ROOT_PARENT\"\n+test_prefix ceil_at_parent \"\"\n+\n+export GIT_CEILING_DIRS=\"$ROOT_PARENT/\"\n+test_prefix ceil_at_parent_slash \"\"\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT\"\n+test_prefix ceil_at_trash \"\"\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT/\"\n+test_prefix ceil_at_trash_slash \"\"\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT/sub\"\n+test_prefix ceil_at_sub \"\"\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT/sub/\"\n+test_prefix ceil_at_sub_slash \"\"\n+\n+\n+mkdir -p sub/dir || exit 1\n+cd sub/dir || exit 1\n+\n+unset GIT_CEILING_DIRS\n+test_prefix subdir_no_ceil \"sub/dir/\"\n+\n+export GIT_CEILING_DIRS=\"\"\n+test_prefix subdir_ceil_empty \"sub/dir/\"\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT\"\n+test_fail subdir_ceil_at_trash\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT/\"\n+test_fail subdir_ceil_at_trash_slash\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT/sub\"\n+test_fail subdir_ceil_at_sub\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT/sub/\"\n+test_fail subdir_ceil_at_sub_slash\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT/sub/dir\"\n+test_prefix subdir_ceil_at_subdir \"sub/dir/\"\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT/sub/dir/\"\n+test_prefix subdir_ceil_at_subdir_slash \"sub/dir/\"\n+\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT/su\"\n+test_prefix subdir_ceil_at_su \"sub/dir/\"\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT/su/\"\n+test_prefix subdir_ceil_at_su_slash \"sub/dir/\"\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT/subdi\"\n+test_prefix subdir_ceil_at_subdi \"sub/dir/\"\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT/subdi\"\n+test_prefix subdir_ceil_at_subdi_slash \"sub/dir/\"\n+\n+\n+export GIT_CEILING_DIRS=\"foo:$TRASH_ROOT/sub\"\n+test_fail second_of_two\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT/sub:bar\"\n+test_fail first_of_two\n+\n+export GIT_CEILING_DIRS=\"foo:$TRASH_ROOT/sub:bar\"\n+test_fail second_of_three\n+\n+\n+export GIT_CEILING_DIRS=\"$TRASH_ROOT/sub\"\n+export GIT_DIR=../../.git\n+test_prefix git_dir_specified \"\"\n+\n+test_done\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 7c2a8ba..22899c1 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -35,6 +35,7 @@ unset GIT_WORK_TREE\n unset GIT_EXTERNAL_DIFF\n unset GIT_INDEX_FILE\n unset GIT_OBJECT_DIRECTORY\n+unset GIT_CEILING_DIRS\n unset SHA1_FILE_DIRECTORIES\n unset SHA1_FILE_DIRECTORY\n GIT_MERGE_VERBOSITY=5\n-- \n1.5.4\n"},{"id":"76929","messageId":"alpine.DEB.1.00.0805140903560.30431@racer","threadId":"13508","inReplyTo":"482A7CA0.9060908@facebook.com","subject":"Re: [PATCH 2/2] Add support for GIT_CEILING_DIRS","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-05-14T08:23:49Z","receivedAt":"2008-05-14T08:23:49Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 13 May 2008, David Reiss wrote:\n\n> Make git recognize a new environment variable that prevents it from \n> chdir'ing up into specified directories when looking for a GIT_DIR. \n> Useful for avoiding slow network directories.\n> \n> Signed-off-by: David Reiss <dreiss@facebook.com>\n> ---\n> Just a bit of context about the motivation for this.  I use git in an \n> environment where homedirs are automounted and \"ls /home/nonexistent\" \n> takes about 9 seconds.\n\nI think this is a very strong argument in favor of your patch, so it \nbelongs into the commit message.\n\n> diff --git a/setup.c b/setup.c\n> index c54f2b6..d7d986c 100644\n> --- a/setup.c\n> +++ b/setup.c\n> @@ -359,10 +359,11 @@ const char *read_gitfile_gently(const char *path)\n>  const char *setup_git_directory_gently(int *nongit_ok)\n>  {\n>  \tconst char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);\n> +\tconst char *env_ceiling_dirs = getenv(CEILING_DIRS_ENVIRONMENT);\n>  \tstatic char cwd[PATH_MAX+1];\n>  \tconst char *gitdirenv;\n>  \tconst char *gitfile_dir;\n> -\tint len, offset;\n> +\tint len, offset, min_offset = -1;\n\nAFAIR we have min_offset in the mingw branch, too, but I think it is \ninitialized to 0.\n\n> @@ -414,6 +415,37 @@ const char *setup_git_directory_gently(int *nongit_ok)\n>  \tif (!getcwd(cwd, sizeof(cwd)-1))\n>  \t\tdie(\"Unable to read current working directory\");\n>  \n> +\t// Compute min_offset based on GIT_CEILING_DIRS.\n\nWe do not like C99 style comments.  Remember, there are people who compile \nGit on something else than the super-latest Linux with cutting-edge GCC.\n\n> +\tif (env_ceiling_dirs) {\n> +\t\tchar *ceils, *ceil, *colon;\n> +\t\tceil = ceils = xstrdup(env_ceiling_dirs);\n\nI think it is quite possible to do this without data copying.\n\nBesides, I think that this whole block should be a function in path.c, if \nonly to _document_ what it does: it is much easier to read for people who \ndid not write the code.\n\nSomething like\n\n\tint longest_prefix(const char *path, const char *prefix_list)\n\t{\n\t\tint max_length = 0, length = 0, i;\n\n\t\tfor (i = 0; *prefix_list; i++)\n\t\t\tif (prefix_list[i] == ':') {\n\t\t\t\tif (length > max_length)\n\t\t\t\t\tmax_length = length;\n\t\t\t\tlength = 0;\n\t\t\t}\n\t\t\telse if (length >= 0) {\n\t\t\t\tif (prefix_list[i] == path[length])\n\t\t\t\t\tlength++;\n\t\t\t\telse {\n\t\t\t\t\tif (length > max_length)\n\t\t\t\t\t\tmax_length = length;\n\t\t\t\t\tlength = -1;\n\t\t\t\t}\n\t\t\t}\n\n\t\treturn max_length;\n\t}\n\n(Completely untested, though.)\n\n> @@ -427,6 +459,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n>  \t */\n>  \toffset = len = strlen(cwd);\n>  \tfor (;;) {\n> +\t\t// Check the current directory (.git first).\n\nAgain, C99 comments are a no-go.\n\n> @@ -443,17 +476,29 @@ const char *setup_git_directory_gently(int *nongit_ok)\n>  \t\t\tcheck_repository_format_gently(nongit_ok);\n>  \t\t\treturn NULL;\n>  \t\t}\n> -\t\tdo {\n> -\t\t\tif (!offset) {\n> -\t\t\t\tif (nongit_ok) {\n> -\t\t\t\t\tif (chdir(cwd))\n> -\t\t\t\t\t\tdie(\"Cannot come back to cwd\");\n> -\t\t\t\t\t*nongit_ok = 1;\n> -\t\t\t\t\treturn NULL;\n> -\t\t\t\t}\n> -\t\t\t\tdie(\"Not a git repository\");\n> +\n> +\t\t// Did we just check the root dir?\n> +\t\tif (!offset) {\n> +\t\tnot_a_repo:\n> +\t\t\tif (nongit_ok) {\n> +\t\t\t\tif (chdir(cwd))\n> +\t\t\t\t\tdie(\"Cannot come back to cwd\");\n> +\t\t\t\t*nongit_ok = 1;\n> +\t\t\t\treturn NULL;\n>  \t\t\t}\n> -\t\t} while (cwd[--offset] != '/');\n> +\t\t\tdie(\"Not a git repository\");\n> +\t\t}\n> +\n> +\t\twhile (cwd[--offset] != '/') {\n> +\t\t\tassert(offset > 0);\n> +\t\t}\n> +\n> +\t\t// Don't chdir into the ceiling.\n> +\t\tif (offset <= min_offset) {\n> +\t\t\tassert(offset == min_offset);\n> +\t\t\tgoto not_a_repo;\n> +\t\t}\n> +\n>  \t\tchdir(\"..\");\n\nWhy this big, ugly change in the code?  I would have expected you to \nsimply change the \"if (!offset)\" to \"if (offset <= min_offset)\" (together \nwith the initialization to 0).\n\n> diff --git a/t/t1504-ceiling-dirs.sh b/t/t1504-ceiling-dirs.sh\n> new file mode 100755\n> index 0000000..d4eaa13\n> --- /dev/null\n> +++ b/t/t1504-ceiling-dirs.sh\n> @@ -0,0 +1,104 @@\n> +#!/bin/sh\n> +\n> +test_description='test GIT_CEILING_DIRS'\n> +. ./test-lib.sh\n> +\n> +test_prefix() {\n> +\ttest_expect_success \"$1\" \\\n> +\t\"test '$2' = \\\"\\$(git rev-parse --show-prefix)\\\"\"\n> +\tshift\n> +\t[ $# -eq 0 ] && return\n> +}\n> +\n> +test_fail() {\n> +\ttest_expect_code 128 \"$1: prefix\" \\\n> +\t\"git rev-parse --show-prefix\"\n> +\tshift\n> +\t[ $# -eq 0 ] && return\n> +}\n\nI think it would make more sense to write these out.  Besides, I think \nthat the \"&& return\" is not necessary.\n\nAnd your tests are, uhm,  quite extensive.\n\nCiao,\nDscho\n"},{"id":"76935","messageId":"482ABD88.30103@viscovery.net","threadId":"13508","inReplyTo":"alpine.DEB.1.00.0805140903560.30431@racer","subject":"Re: [PATCH 2/2] Add support for GIT_CEILING_DIRS","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-05-14T10:23:04Z","receivedAt":"2008-05-14T10:23:04Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Johannes Schindelin schrieb:\n> On Tue, 13 May 2008, David Reiss wrote:\n>> diff --git a/setup.c b/setup.c\n>> index c54f2b6..d7d986c 100644\n>> --- a/setup.c\n>> +++ b/setup.c\n>> @@ -359,10 +359,11 @@ const char *read_gitfile_gently(const char *path)\n>>  const char *setup_git_directory_gently(int *nongit_ok)\n>>  {\n>>  \tconst char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);\n>> +\tconst char *env_ceiling_dirs = getenv(CEILING_DIRS_ENVIRONMENT);\n>>  \tstatic char cwd[PATH_MAX+1];\n>>  \tconst char *gitdirenv;\n>>  \tconst char *gitfile_dir;\n>> -\tint len, offset;\n>> +\tint len, offset, min_offset = -1;\n> \n> AFAIR we have min_offset in the mingw branch, too, but I think it is \n> initialized to 0.\n\nYes, indeed, and even for much the same purpose (i.e. to stop before the\nbeginning of the path is reached - on Windows we don't want to look at\n\"C:\" prefixes). Please look at this commit:\n\nhttp://repo.or.cz/w/git/mingw/j6t.git?a=commitdiff;h=4ab30965f520bd444f3eefe1dee4622181933f90\n\n-- Hannes\n"},{"id":"76950","messageId":"D2EA6017-4607-4A55-8C72-CD2B772CAAE4@sb.org","threadId":"13508","inReplyTo":"alpine.DEB.1.00.0805140903560.30431@racer","subject":"Re: [PATCH 2/2] Add support for GIT_CEILING_DIRS","fromName":"Kevin Ballard","fromEmail":"kevin@sb.org","sentAt":"2008-05-14T16:51:19Z","receivedAt":"2008-05-14T16:51:19Z","isPatch":true,"sender":{"key":"kevin@sb.org","avatar":"https://avatars.githubusercontent.com/u/714?v=4"},"body":"On May 14, 2008, at 3:23 AM, Johannes Schindelin wrote:\n\n>> @@ -414,6 +415,37 @@ const char *setup_git_directory_gently(int  \n>> *nongit_ok)\n>> \tif (!getcwd(cwd, sizeof(cwd)-1))\n>> \t\tdie(\"Unable to read current working directory\");\n>>\n>> +\t// Compute min_offset based on GIT_CEILING_DIRS.\n>\n> We do not like C99 style comments.  Remember, there are people who  \n> compile\n> Git on something else than the super-latest Linux with cutting-edge  \n> GCC.\n\nOut of curiosity, what environment these days doesn't allow C99  \ncomments? I think I started programming roughly 10 years ago (granted,  \nI didn't start with C, but I did C programming at least 8 years ago,  \nif not earlier) and every environment I've ever used has supported  \nthose comments even in C89 mode.\n\nI mean, I fully understand that git wants to be portable across all  \nplatforms, but it still makes me wonder if there's any environment  \nthat anybody actually uses these days that doesn't understand those  \ncomments when compiling C.\n\n-- \nKevin Ballard\nhttp://kevin.sb.org\nkevin@sb.org\nhttp://www.tildesoft.com\n"},{"id":"76952","messageId":"alpine.DEB.1.00.0805141759120.30431@racer","threadId":"13508","inReplyTo":"D2EA6017-4607-4A55-8C72-CD2B772CAAE4@sb.org","subject":"Re: [PATCH 2/2] Add support for GIT_CEILING_DIRS","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-05-14T17:02:24Z","receivedAt":"2008-05-14T17:02:24Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 14 May 2008, Kevin Ballard wrote:\n\n> On May 14, 2008, at 3:23 AM, Johannes Schindelin wrote:\n> \n> > >@@ -414,6 +415,37 @@ const char *setup_git_directory_gently(int *nongit_ok)\n> > > if (!getcwd(cwd, sizeof(cwd)-1))\n> > >  die(\"Unable to read current working directory\");\n> > >\n> > >+\t// Compute min_offset based on GIT_CEILING_DIRS.\n> >\n> >We do not like C99 style comments.  Remember, there are people who compile\n> >Git on something else than the super-latest Linux with cutting-edge GCC.\n> \n> Out of curiosity, what environment these days doesn't allow C99 comments?\n\nOn an SGI/IRIX machine I was working some time ago, GCC was too big for my \nquota.  And the admin was not willing to install it.\n\nBut I have to wonder: why argue something as C99 comments, when it is _no \nproblem_ whatsoever to replace them with C89-style comments, especially \ngiven the fact that this makes our source code more consistent and thus \neasier on the eye?\n\nCiao,\nDscho\n"},{"id":"76958","messageId":"71122C3E-67C8-42B0-BF95-D907718F9A57@sb.org","threadId":"13508","inReplyTo":"alpine.DEB.1.00.0805141759120.30431@racer","subject":"Re: [PATCH 2/2] Add support for GIT_CEILING_DIRS","fromName":"Kevin Ballard","fromEmail":"kevin@sb.org","sentAt":"2008-05-14T17:07:50Z","receivedAt":"2008-05-14T17:07:50Z","isPatch":true,"sender":{"key":"kevin@sb.org","avatar":"https://avatars.githubusercontent.com/u/714?v=4"},"body":"On May 14, 2008, at 12:02 PM, Johannes Schindelin wrote:\n\n> On Wed, 14 May 2008, Kevin Ballard wrote:\n>\n>> On May 14, 2008, at 3:23 AM, Johannes Schindelin wrote:\n>>\n>>>> @@ -414,6 +415,37 @@ const char *setup_git_directory_gently(int  \n>>>> *nongit_ok)\n>>>> if (!getcwd(cwd, sizeof(cwd)-1))\n>>>> die(\"Unable to read current working directory\");\n>>>>\n>>>> +\t// Compute min_offset based on GIT_CEILING_DIRS.\n>>>\n>>> We do not like C99 style comments.  Remember, there are people who  \n>>> compile\n>>> Git on something else than the super-latest Linux with cutting- \n>>> edge GCC.\n>>\n>> Out of curiosity, what environment these days doesn't allow C99  \n>> comments?\n>\n> On an SGI/IRIX machine I was working some time ago, GCC was too big  \n> for my\n> quota.  And the admin was not willing to install it.\n>\n> But I have to wonder: why argue something as C99 comments, when it  \n> is _no\n> problem_ whatsoever to replace them with C89-style comments,  \n> especially\n> given the fact that this makes our source code more consistent and  \n> thus\n> easier on the eye?\n\nOh I wasn't intending to argue, I just was curious. I'm always happy  \nto adopt the style of the surrounding code (except when people use the  \nOne True Brace Style, ugh).\n\nGranted, I personally prefer C99 comments for one-liners and C89  \ncomments for multi-liners. It's especially helpful if the comment goes  \noff the right side of the screen, because I don't have to hunt for the  \nclosing */ (source code highlighting generally solves this issue, but  \nI don't always read code in an environment that can understand it,  \ne.g. email).\n\n-Kevin Ballard\n\n-- \nKevin Ballard\nhttp://kevin.sb.org\nkevin@sb.org\nhttp://www.tildesoft.com\n"}]}