* [PATCH] Move deny_non_fast_forwards handling completely into receive-pack.
@ 2006-10-30 22:35 Shawn Pearce
2006-10-30 23:06 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Shawn Pearce @ 2006-10-30 22:35 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
The 'receive.denynonfastforwards' option has nothing to do with
the repository format version. Since receive-pack already uses
git_config to initialize itself before executing any updates we
can use the normal configuration strategy and isolate the receive
specific variables away from the core variables.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
cache.h | 1 -
environment.c | 1 -
receive-pack.c | 16 +++++++++++++++-
setup.c | 2 --
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/cache.h b/cache.h
index a360528..e997a85 100644
--- a/cache.h
+++ b/cache.h
@@ -189,7 +189,6 @@ extern int prefer_symlink_refs;
extern int log_all_ref_updates;
extern int warn_ambiguous_refs;
extern int shared_repository;
-extern int deny_non_fast_forwards;
extern const char *apply_default_whitespace;
extern int zlib_compression_level;
diff --git a/environment.c b/environment.c
index 63b1d15..84d870c 100644
--- a/environment.c
+++ b/environment.c
@@ -20,7 +20,6 @@ int warn_ambiguous_refs = 1;
int repository_format_version;
char git_commit_encoding[MAX_ENCODING_LENGTH] = "utf-8";
int shared_repository = PERM_UMASK;
-int deny_non_fast_forwards = 0;
const char *apply_default_whitespace;
int zlib_compression_level = Z_DEFAULT_COMPRESSION;
int pager_in_use;
diff --git a/receive-pack.c b/receive-pack.c
index f6f1729..e966148 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -12,12 +12,26 @@ static const char *keep_packer[] = {
"index-pack", "--stdin", "--fix-thin", NULL
};
+static int deny_non_fast_forwards = 0;
static int report_status;
static int keep_pack;
static char capabilities[] = "report-status keep-pack";
static int capabilities_sent;
+static int receive_pack_config(const char *var, const char *value)
+{
+ git_default_config(var, value);
+
+ if (strcmp(var, "receive.denynonfastforwards") == 0)
+ {
+ deny_non_fast_forwards = git_config_bool(var, value);
+ return 0;
+ }
+
+ return 0;
+}
+
static int show_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)
{
if (capabilities_sent)
@@ -290,7 +304,7 @@ int main(int argc, char **argv)
die("'%s': unable to chdir or not a git archive", dir);
setup_ident();
- git_config(git_default_config);
+ git_config(receive_pack_config);
write_head_info();
diff --git a/setup.c b/setup.c
index 9a46a58..2afdba4 100644
--- a/setup.c
+++ b/setup.c
@@ -244,8 +244,6 @@ int check_repository_format_version(cons
repository_format_version = git_config_int(var, value);
else if (strcmp(var, "core.sharedrepository") == 0)
shared_repository = git_config_perm(var, value);
- else if (strcmp(var, "receive.denynonfastforwards") == 0)
- deny_non_fast_forwards = git_config_bool(var, value);
return 0;
}
--
1.4.3.3.g7d63
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Move deny_non_fast_forwards handling completely into receive-pack.
2006-10-30 22:35 [PATCH] Move deny_non_fast_forwards handling completely into receive-pack Shawn Pearce
@ 2006-10-30 23:06 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2006-10-30 23:06 UTC (permalink / raw)
To: Shawn Pearce; +Cc: git
Shawn Pearce <spearce@spearce.org> writes:
> The 'receive.denynonfastforwards' option has nothing to do with
> the repository format version. Since receive-pack already uses
> git_config to initialize itself before executing any updates we
> can use the normal configuration strategy and isolate the receive
> specific variables away from the core variables.
Sounds sane. Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-10-30 23:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-30 22:35 [PATCH] Move deny_non_fast_forwards handling completely into receive-pack Shawn Pearce
2006-10-30 23:06 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox