{"thread":{"id":"2530","subject":"[PATCH] Add config variable core.symrefsonly","startedAt":"2005-11-15T18:24:19Z","lastAt":"2005-11-15T18:54:31Z","messageCount":3,"participants":["Johannes Schindelin","Linus Torvalds"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"11920","messageId":"Pine.LNX.4.63.0511151923120.1103@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2530","inReplyTo":null,"subject":"[PATCH] Add config variable core.symrefsonly","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-11-15T18:24:19Z","receivedAt":"2005-11-15T18:24:19Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThis allows you to force git to avoid symlinks for refs. Just add\nsomething like\n\n\t[core]\n\t\tsymrefsonly = true\n\nto .git/config.\n\nDon´t forget to \"git checkout your_branch\", or it does not do anything...\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n\n---\n\n\tLinus, is there any reason you don´t allow spaces, underscores\n\tand dashes in the config variables?\n\n\tPetr, happy?\n\n cache.h        |    1 +\n config.c       |    5 +++++\n environment.c  |    1 +\n refs.c         |   10 ++++++----\n symbolic-ref.c |    1 +\n 5 files changed, 14 insertions(+), 4 deletions(-)\n\napplies-to: 4b6dbe856a3e63699b299c76f4f1fc5cb34cbe26\nb12e60607e70f01de9dc65b88f15c9b17f7be4c5\ndiff --git a/cache.h b/cache.h\nindex 677c6ac..9a6bfb9 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -179,6 +179,7 @@ extern int commit_index_file(struct cach\n extern void rollback_index_file(struct cache_file *);\n \n extern int trust_executable_bit;\n+extern int only_use_symrefs;\n \n #define MTIME_CHANGED\t0x0001\n #define CTIME_CHANGED\t0x0002\ndiff --git a/config.c b/config.c\nindex e89bab2..bd35138 100644\n--- a/config.c\n+++ b/config.c\n@@ -214,6 +214,11 @@ int git_default_config(const char *var, \n \t\treturn 0;\n \t}\n \n+\tif (!strcmp(var, \"core.symrefsonly\")) {\n+\t\tonly_use_symrefs = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n \tif (!strcmp(var, \"user.name\")) {\n \t\tstrncpy(git_default_name, value, sizeof(git_default_name));\n \t\treturn 0;\ndiff --git a/environment.c b/environment.c\nindex 1dc7af5..b5026f1 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -12,6 +12,7 @@\n char git_default_email[MAX_GITNAME];\n char git_default_name[MAX_GITNAME];\n int trust_executable_bit = 1;\n+int only_use_symrefs = 0;\n \n static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,\n \t*git_graft_file;\ndiff --git a/refs.c b/refs.c\nindex a52b038..f324be5 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -121,10 +121,12 @@ int create_symref(const char *git_HEAD, \n \tint fd, len, written;\n \n #if USE_SYMLINK_HEAD\n-\tunlink(git_HEAD);\n-\tif (!symlink(refs_heads_master, git_HEAD))\n-\t\treturn 0;\n-\tfprintf(stderr, \"no symlink - falling back to symbolic ref\\n\");\n+\tif (!only_use_symrefs) {\n+\t\tunlink(git_HEAD);\n+\t\tif (!symlink(refs_heads_master, git_HEAD))\n+\t\t\treturn 0;\n+\t\tfprintf(stderr, \"no symlink - falling back to symbolic ref\\n\");\n+\t}\n #endif\n \n \tlen = snprintf(ref, sizeof(ref), \"ref: %s\\n\", refs_heads_master);\ndiff --git a/symbolic-ref.c b/symbolic-ref.c\nindex a72d7ac..193c87c 100644\n--- a/symbolic-ref.c\n+++ b/symbolic-ref.c\n@@ -20,6 +20,7 @@ static void check_symref(const char *HEA\n int main(int argc, const char **argv)\n {\n \tsetup_git_directory();\n+\tgit_config(git_default_config);\n \tswitch (argc) {\n \tcase 2:\n \t\tcheck_symref(argv[1]);\n---\n0.99.9.GIT"},{"id":"11922","messageId":"Pine.LNX.4.64.0511151028540.3945@g5.osdl.org","threadId":"2530","inReplyTo":"Pine.LNX.4.63.0511151923120.1103@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Add config variable core.symrefsonly","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-11-15T18:39:50Z","receivedAt":"2005-11-15T18:39:50Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 15 Nov 2005, Johannes Schindelin wrote:\n> \n> \tLinus, is there any reason you don´t allow spaces, underscores\n> \tand dashes in the config variables?\n\nI much preferred being anal and maybe relaxing the rules later than being \npermissive and accepting horrible crap.\n\nSpaces are definitely out, since we are trying to igore whitespace \neverywhere, but underscores and dashes might be ok.\n\nHowever, the traditional way to do these kinds of things in ini files is \nwith PrettyCaps(tm), ie you'd do\n\n\t[core]\n\t\tSymRefsOnly = true\n\nrather than the C way.\n\nLet's face it, the C way is the only true way for a programming language, \nbut having case matter in something unimportant and human-readable like a \n\"ini\" file is just bothersome, so PrettyCase(tm) actually makes sense \nthere.\n\nPrettyCase is for toys - unimportant things where it's more important to \nsay \"we don't care\" over saying \"we need to be precise\". So Pascal is PC. \nIt's a toy language. FAT is PC - it's a toy filesystem. And ini files are \nPC: it's more important that a config file is human-readable than it is \nthat it's very precise and strict.\n\nPut another way: real programmers want strict rules, because they know \nthey'll be hurt without them. But _users_ need to be coddled. And ini \nfiles aren't for programmers, they are for users.\n\n\t\tLinus"},{"id":"11925","messageId":"Pine.LNX.4.63.0511151953001.1427@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2530","inReplyTo":"Pine.LNX.4.64.0511151028540.3945@g5.osdl.org","subject":"Re: [PATCH] Add config variable core.symrefsonly","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-11-15T18:54:31Z","receivedAt":"2005-11-15T18:54:31Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 15 Nov 2005, Linus Torvalds wrote:\n\n> On Tue, 15 Nov 2005, Johannes Schindelin wrote:\n> > \n> > \tLinus, is there any reason you don´t allow spaces, underscores\n> > \tand dashes in the config variables?\n> \n> [...]\n>\n> PrettyCase is for toys [...] And ini files are PC: it's more important \n> that a config file is human-readable than it is that it's very precise \n> and strict.\n\nThanks for the explanation. Makes sense.\n\nCiao,\nDscho"}]}