{"thread":{"id":"43302","subject":"Re: [PATCH] Move deny_non_fast_forwards handling completely into receive-pack.","startedAt":"2006-10-30T22:35:18Z","lastAt":"2006-10-30T23:06:45Z","messageCount":2,"participants":["Junio C Hamano","Shawn Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"297299","messageId":"20061030223518.GF5775@spearce.org","threadId":"43302","inReplyTo":null,"subject":"[PATCH] Move deny_non_fast_forwards handling completely into receive-pack.","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-10-30T22:35:18Z","receivedAt":"2006-10-30T22:35:18Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"The 'receive.denynonfastforwards' option has nothing to do with\nthe repository format version.  Since receive-pack already uses\ngit_config to initialize itself before executing any updates we\ncan use the normal configuration strategy and isolate the receive\nspecific variables away from the core variables.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n cache.h        |    1 -\n environment.c  |    1 -\n receive-pack.c |   16 +++++++++++++++-\n setup.c        |    2 --\n 4 files changed, 15 insertions(+), 5 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex a360528..e997a85 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -189,7 +189,6 @@ extern int prefer_symlink_refs;\n extern int log_all_ref_updates;\n extern int warn_ambiguous_refs;\n extern int shared_repository;\n-extern int deny_non_fast_forwards;\n extern const char *apply_default_whitespace;\n extern int zlib_compression_level;\n \ndiff --git a/environment.c b/environment.c\nindex 63b1d15..84d870c 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -20,7 +20,6 @@ int warn_ambiguous_refs = 1;\n int repository_format_version;\n char git_commit_encoding[MAX_ENCODING_LENGTH] = \"utf-8\";\n int shared_repository = PERM_UMASK;\n-int deny_non_fast_forwards = 0;\n const char *apply_default_whitespace;\n int zlib_compression_level = Z_DEFAULT_COMPRESSION;\n int pager_in_use;\ndiff --git a/receive-pack.c b/receive-pack.c\nindex f6f1729..e966148 100644\n--- a/receive-pack.c\n+++ b/receive-pack.c\n@@ -12,12 +12,26 @@ static const char *keep_packer[] = {\n \t\"index-pack\", \"--stdin\", \"--fix-thin\", NULL\n };\n \n+static int deny_non_fast_forwards = 0;\n static int report_status;\n static int keep_pack;\n \n static char capabilities[] = \"report-status keep-pack\";\n static int capabilities_sent;\n \n+static int receive_pack_config(const char *var, const char *value)\n+{\n+\tgit_default_config(var, value);\n+\n+\tif (strcmp(var, \"receive.denynonfastforwards\") == 0)\n+\t{\n+\t\tdeny_non_fast_forwards = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int show_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)\n {\n \tif (capabilities_sent)\n@@ -290,7 +304,7 @@ int main(int argc, char **argv)\n \t\tdie(\"'%s': unable to chdir or not a git archive\", dir);\n \n \tsetup_ident();\n-\tgit_config(git_default_config);\n+\tgit_config(receive_pack_config);\n \n \twrite_head_info();\n \ndiff --git a/setup.c b/setup.c\nindex 9a46a58..2afdba4 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -244,8 +244,6 @@ int check_repository_format_version(cons\n                repository_format_version = git_config_int(var, value);\n \telse if (strcmp(var, \"core.sharedrepository\") == 0)\n \t\tshared_repository = git_config_perm(var, value);\n-\telse if (strcmp(var, \"receive.denynonfastforwards\") == 0)\n-\t\tdeny_non_fast_forwards = git_config_bool(var, value);\n        return 0;\n }\n \n-- \n1.4.3.3.g7d63\n"},{"id":"294274","messageId":"7vpsc9tncq.fsf@assigned-by-dhcp.cox.net","threadId":"43302","inReplyTo":"20061030223518.GF5775@spearce.org","subject":"Re: [PATCH] Move deny_non_fast_forwards handling completely into receive-pack.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-30T23:06:45Z","receivedAt":"2006-10-30T23:06:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Shawn Pearce <spearce@spearce.org> writes:\n\n> The 'receive.denynonfastforwards' option has nothing to do with\n> the repository format version.  Since receive-pack already uses\n> git_config to initialize itself before executing any updates we\n> can use the normal configuration strategy and isolate the receive\n> specific variables away from the core variables.\n\nSounds sane.  Thanks.\n\n"}]}