core.prefersymlinkrefs: use symlinks for .git/HEAD
When inspecting a project whose build infrastructure used to assume that .git/HEAD is a symlink ref, core.prefersymlinkrefs in the config file of such a project would help to bisect its history. Signed-off-by: Junio C Hamano <junkio@cox.net> (cherry picked from 9f0bb90d161edf8c43f5261d12bf83f14eb02ff4 commit)
Junio C Hamano committed
May 2, 2006 at 00:40 UTC
e388c7382563b7497397c78bc078d0679dc891a8
6 files changed
+17
-11
Documentation/config.txt
+5
-3
@@ -64,9 +64,11 @@ core.ignoreStat::
64
slow, such as Microsoft Windows. See gitlink:git-update-index[1].
65
False by default.
66
67
-core.onlyUseSymrefs::
68
- Always use the "symref" format instead of symbolic links for HEAD
69
- and other symbolic reference files. True by default.
67
+core.preferSymlinkRefs::
68
+ Instead of the default "symref" format for HEAD
69
+ and other symbolic reference files, use symbolic links.
70
+ This is sometimes needed to work with old scripts that
71
+ expect HEAD to be a symbolic link.
72
73
core.repositoryFormatVersion::
74
Internal variable identifying the repository format and layout
Makefile
+6
-2
@@ -28,8 +28,8 @@ all:
28
#
29
# Define NO_SETENV if you don't have setenv in the C library.
30
#
31
-# Define USE_SYMLINK_HEAD if you want .git/HEAD to be a symbolic link.
32
-# Don't enable it on Windows.
31
+# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
32
+# Enable it on Windows. By default, symrefs are still used.
33
#
34
# Define PPC_SHA1 environment variable when running make to make use of
35
# a bundled SHA1 routine optimized for PowerPC.
@@ -260,6 +260,7 @@ ifeq ($(uname_O),Cygwin)
260
NO_D_TYPE_IN_DIRENT = YesPlease
261
NO_D_INO_IN_DIRENT = YesPlease
262
NO_STRCASESTR = YesPlease
263
+ NO_SYMLINK_HEAD = YesPlease
264
NEEDS_LIBICONV = YesPlease
265
# There are conflicting reports about this.
266
# On some boxes NO_MMAP is needed, and not so elsewhere.
@@ -383,6 +384,9 @@ endif
384
ifdef NO_D_INO_IN_DIRENT
385
ALL_CFLAGS += -DNO_D_INO_IN_DIRENT
386
endif
387
+ifdef NO_SYMLINK_HEAD
388
+ ALL_CFLAGS += -DNO_SYMLINK_HEAD
389
+endif
390
ifdef NO_STRCASESTR
391
COMPAT_CFLAGS += -DNO_STRCASESTR
392
COMPAT_OBJS += compat/strcasestr.o
cache.h
+1
-1
@@ -168,7 +168,7 @@ extern void rollback_index_file(struct cache_file *);
168
/* Environment bits from configuration mechanism */
169
extern int trust_executable_bit;
170
extern int assume_unchanged;
171
-extern int only_use_symrefs;
171
+extern int prefer_symlink_refs;
172
extern int warn_ambiguous_refs;
173
extern int diff_rename_limit_default;
174
extern int shared_repository;
config.c
+2
-2
@@ -227,8 +227,8 @@ int git_default_config(const char *var, const char *value)
227
return 0;
228
}
229
230
- if (!strcmp(var, "core.symrefsonly")) {
231
- only_use_symrefs = git_config_bool(var, value);
230
+ if (!strcmp(var, "core.prefersymlinkrefs")) {
231
+ prefer_symlink_refs = git_config_bool(var, value);
232
return 0;
233
}
234
environment.c
+1
-1
@@ -13,7 +13,7 @@ char git_default_email[MAX_GITNAME];
13
char git_default_name[MAX_GITNAME];
14
int trust_executable_bit = 1;
15
int assume_unchanged = 0;
16
-int only_use_symrefs = 0;
16
+int prefer_symlink_refs = 0;
17
int warn_ambiguous_refs = 1;
18
int repository_format_version = 0;
19
char git_commit_encoding[MAX_ENCODING_LENGTH] = "utf-8";
refs.c
+2
-2
@@ -76,8 +76,8 @@ int create_symref(const char *git_HEAD, const char *refs_heads_master)
76
char ref[1000];
77
int fd, len, written;
78
79
-#ifdef USE_SYMLINK_HEAD
80
- if (!only_use_symrefs) {
79
+#ifndef NO_SYMLINK_HEAD
80
+ if (prefer_symlink_refs) {
81
unlink(git_HEAD);
82
if (!symlink(refs_heads_master, git_HEAD))
83
return 0;