@matheusbsbs / matheus-bagliano / commits / 9f0bb90d16
Fork 0

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>

Junio C Hamano committed May 2, 2006 at 00:40 UTC 9f0bb90d161edf8c43f5261d12bf83f14eb02ff4
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.
@@ -263,6 +263,7 @@ ifeq ($(uname_O),Cygwin)
263 NO_D_TYPE_IN_DIRENT = YesPlease
264 NO_D_INO_IN_DIRENT = YesPlease
265 NO_STRCASESTR = YesPlease
266 + NO_SYMLINK_HEAD = YesPlease
267 NEEDS_LIBICONV = YesPlease
268 # There are conflicting reports about this.
269 # On some boxes NO_MMAP is needed, and not so elsewhere.
@@ -386,6 +387,9 @@ endif
387 ifdef NO_D_INO_IN_DIRENT
388 ALL_CFLAGS += -DNO_D_INO_IN_DIRENT
389 endif
390 +ifdef NO_SYMLINK_HEAD
391 + ALL_CFLAGS += -DNO_SYMLINK_HEAD
392 +endif
393 ifdef NO_STRCASESTR
394 COMPAT_CFLAGS += -DNO_STRCASESTR
395 COMPAT_OBJS += compat/strcasestr.o
cache.h
+1 -1
@@ -169,7 +169,7 @@ extern void rollback_index_file(struct cache_file *);
169 /* Environment bits from configuration mechanism */
170 extern int trust_executable_bit;
171 extern int assume_unchanged;
172 -extern int only_use_symrefs;
172 +extern int prefer_symlink_refs;
173 extern int warn_ambiguous_refs;
174 extern int diff_rename_limit_default;
175 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;