aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2005-11-15 19:24:19 +0100
committerJunio C Hamano <junkio@cox.net>2005-11-15 11:42:29 -0800
commitf8348be3be8493a62110a09ab0343213990b416b (patch)
treeefad0bc70473bdc02b8ac6a5e5f001519f1d5dfa
parent4a4e6fd74f7d4564ed43eaaf59b6bd70c1959f1a (diff)
downloadgit-f8348be3be8493a62110a09ab0343213990b416b.tar.gz
git-f8348be3be8493a62110a09ab0343213990b416b.tar.xz
Add config variable core.symrefsonly
This allows you to force git to avoid symlinks for refs. Just add something like [core] symrefsonly = true to .git/config. DonĀ“t forget to "git checkout your_branch", or it does not do anything... Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--cache.h1
-rw-r--r--config.c5
-rw-r--r--environment.c1
-rw-r--r--refs.c10
-rw-r--r--symbolic-ref.c1
5 files changed, 14 insertions, 4 deletions
diff --git a/cache.h b/cache.h
index 677c6acc3..9a6bfb96d 100644
--- a/cache.h
+++ b/cache.h
@@ -179,6 +179,7 @@ extern int commit_index_file(struct cache_file *);
extern void rollback_index_file(struct cache_file *);
extern int trust_executable_bit;
+extern int only_use_symrefs;
#define MTIME_CHANGED 0x0001
#define CTIME_CHANGED 0x0002
diff --git a/config.c b/config.c
index e89bab26c..bd35138da 100644
--- a/config.c
+++ b/config.c
@@ -214,6 +214,11 @@ int git_default_config(const char *var, const char *value)
return 0;
}
+ if (!strcmp(var, "core.symrefsonly")) {
+ only_use_symrefs = git_config_bool(var, value);
+ return 0;
+ }
+
if (!strcmp(var, "user.name")) {
strncpy(git_default_name, value, sizeof(git_default_name));
return 0;
diff --git a/environment.c b/environment.c
index 1dc7af56c..b5026f126 100644
--- a/environment.c
+++ b/environment.c
@@ -12,6 +12,7 @@
char git_default_email[MAX_GITNAME];
char git_default_name[MAX_GITNAME];
int trust_executable_bit = 1;
+int only_use_symrefs = 0;
static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
*git_graft_file;
diff --git a/refs.c b/refs.c
index a52b038ee..f324be503 100644
--- a/refs.c
+++ b/refs.c
@@ -121,10 +121,12 @@ int create_symref(const char *git_HEAD, const char *refs_heads_master)
int fd, len, written;
#if USE_SYMLINK_HEAD
- unlink(git_HEAD);
- if (!symlink(refs_heads_master, git_HEAD))
- return 0;
- fprintf(stderr, "no symlink - falling back to symbolic ref\n");
+ if (!only_use_symrefs) {
+ unlink(git_HEAD);
+ if (!symlink(refs_heads_master, git_HEAD))
+ return 0;
+ fprintf(stderr, "no symlink - falling back to symbolic ref\n");
+ }
#endif
len = snprintf(ref, sizeof(ref), "ref: %s\n", refs_heads_master);
diff --git a/symbolic-ref.c b/symbolic-ref.c
index a72d7accb..193c87c17 100644
--- a/symbolic-ref.c
+++ b/symbolic-ref.c
@@ -20,6 +20,7 @@ static void check_symref(const char *HEAD)
int main(int argc, const char **argv)
{
setup_git_directory();
+ git_config(git_default_config);
switch (argc) {
case 2:
check_symref(argv[1]);