]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jc/symref'
authorJunio C Hamano <junkio@cox.net>
Thu, 4 May 2006 06:54:55 +0000 (23:54 -0700)
committerJunio C Hamano <junkio@cox.net>
Thu, 4 May 2006 06:54:55 +0000 (23:54 -0700)
* jc/symref:
  core.prefersymlinkrefs: use symlinks for .git/HEAD

Documentation/config.txt
Makefile
cache.h
config.c
environment.c
refs.c

index b27b0d5c068f5e60faaf684397c605a188a241ac..d1a4bec0d472231abdf026cc0743effa3ae72b27 100644 (file)
@@ -64,9 +64,11 @@ core.ignoreStat::
        slow, such as Microsoft Windows.  See gitlink:git-update-index[1].
        False by default.
 
-core.onlyUseSymrefs::
-       Always use the "symref" format instead of symbolic links for HEAD
-       and other symbolic reference files. True by default.
+core.preferSymlinkRefs::
+       Instead of the default "symref" format for HEAD
+       and other symbolic reference files, use symbolic links.
+       This is sometimes needed to work with old scripts that
+       expect HEAD to be a symbolic link.
 
 core.repositoryFormatVersion::
        Internal variable identifying the repository format and layout
index c0d444b56068731debc5500f1813b050f48addcf..fea20cce7a70c0b01ce18af6565e9bfe6eb15ace 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -28,8 +28,8 @@ all:
 #
 # Define NO_SETENV if you don't have setenv in the C library.
 #
-# Define USE_SYMLINK_HEAD if you want .git/HEAD to be a symbolic link.
-# Don't enable it on Windows.
+# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
+# Enable it on Windows.  By default, symrefs are still used.
 #
 # Define PPC_SHA1 environment variable when running make to make use of
 # a bundled SHA1 routine optimized for PowerPC.
@@ -264,6 +264,7 @@ ifeq ($(uname_O),Cygwin)
        NO_D_TYPE_IN_DIRENT = YesPlease
        NO_D_INO_IN_DIRENT = YesPlease
        NO_STRCASESTR = YesPlease
+       NO_SYMLINK_HEAD = YesPlease
        NEEDS_LIBICONV = YesPlease
        # There are conflicting reports about this.
        # On some boxes NO_MMAP is needed, and not so elsewhere.
@@ -387,6 +388,9 @@ endif
 ifdef NO_D_INO_IN_DIRENT
        ALL_CFLAGS += -DNO_D_INO_IN_DIRENT
 endif
+ifdef NO_SYMLINK_HEAD
+       ALL_CFLAGS += -DNO_SYMLINK_HEAD
+endif
 ifdef NO_STRCASESTR
        COMPAT_CFLAGS += -DNO_STRCASESTR
        COMPAT_OBJS += compat/strcasestr.o
diff --git a/cache.h b/cache.h
index a4f253ec2576fa5e48f00282342c9291f963f6d2..9d0ddcff016be608e91f105ef7cbb975fb49198a 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -169,7 +169,7 @@ extern void rollback_index_file(struct cache_file *);
 /* Environment bits from configuration mechanism */
 extern int trust_executable_bit;
 extern int assume_unchanged;
-extern int only_use_symrefs;
+extern int prefer_symlink_refs;
 extern int warn_ambiguous_refs;
 extern int diff_rename_limit_default;
 extern int shared_repository;
index 253c48a6130a9268c106170df7205441d4ab36ac..47734140dd4e44b88a9bf620dcd628381e1dd5f3 100644 (file)
--- a/config.c
+++ b/config.c
@@ -227,8 +227,8 @@ 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);
+       if (!strcmp(var, "core.prefersymlinkrefs")) {
+               prefer_symlink_refs = git_config_bool(var, value);
                return 0;
        }
 
index 6df647862c60c5b76540f3038ce37f8a5dcc37c9..444c99ed6efc8e9e1661427e08b44bb8b0e5fbf2 100644 (file)
@@ -13,7 +13,7 @@ char git_default_email[MAX_GITNAME];
 char git_default_name[MAX_GITNAME];
 int trust_executable_bit = 1;
 int assume_unchanged = 0;
-int only_use_symrefs = 0;
+int prefer_symlink_refs = 0;
 int warn_ambiguous_refs = 1;
 int repository_format_version = 0;
 char git_commit_encoding[MAX_ENCODING_LENGTH] = "utf-8";
diff --git a/refs.c b/refs.c
index 03398ccc531c15e549b66c43a176fd7b2bde4aca..275b914b2b4cd17f26e85ab1ca5b32ea573acab4 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -76,8 +76,8 @@ int create_symref(const char *git_HEAD, const char *refs_heads_master)
        char ref[1000];
        int fd, len, written;
 
-#ifdef USE_SYMLINK_HEAD
-       if (!only_use_symrefs) {
+#ifndef NO_SYMLINK_HEAD
+       if (prefer_symlink_refs) {
                unlink(git_HEAD);
                if (!symlink(refs_heads_master, git_HEAD))
                        return 0;