Skip to content

Commit 6fbb873

Browse files
committed
Merge branch 'jk/symbolic-ref-no-symlinks' into HEAD
* jk/symbolic-ref-no-symlinks: create_symref: drop support for writing symbolic links create_symref: deprecate support for writing symbolic links
2 parents 99139fd + 3375163 commit 6fbb873

7 files changed

+0
-74
lines changed

Makefile

-6
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ include shared.mak
8181
#
8282
# Define NO_SYS_SELECT_H if you don't have sys/select.h.
8383
#
84-
# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
85-
# Enable it on Windows. By default, symrefs are still used.
86-
#
8784
# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
8885
# tests. These tests take up a significant amount of the total test time
8986
# but are not needed unless you plan to talk to SVN repos.
@@ -1815,9 +1812,6 @@ ifdef OPEN_RETURNS_EINTR
18151812
COMPAT_CFLAGS += -DOPEN_RETURNS_EINTR
18161813
COMPAT_OBJS += compat/open.o
18171814
endif
1818-
ifdef NO_SYMLINK_HEAD
1819-
BASIC_CFLAGS += -DNO_SYMLINK_HEAD
1820-
endif
18211815
ifdef NO_GETTEXT
18221816
BASIC_CFLAGS += -DNO_GETTEXT
18231817
USE_GETTEXT_SCHEME ?= fallthrough

config.mak.uname

-3
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ ifeq ($(uname_O),Cygwin)
238238
NO_D_TYPE_IN_DIRENT = YesPlease
239239
NO_STRCASESTR = YesPlease
240240
NO_MEMMEM = YesPlease
241-
NO_SYMLINK_HEAD = YesPlease
242241
NO_IPV6 = YesPlease
243242
OLD_ICONV = UnfortunatelyYes
244243
# There are conflicting reports about this.
@@ -446,7 +445,6 @@ ifeq ($(uname_S),Windows)
446445
NEEDS_CRYPTO_WITH_SSL = YesPlease
447446
NO_LIBGEN_H = YesPlease
448447
NO_POLL = YesPlease
449-
NO_SYMLINK_HEAD = YesPlease
450448
NO_IPV6 = YesPlease
451449
NO_SETENV = YesPlease
452450
NO_STRCASESTR = YesPlease
@@ -661,7 +659,6 @@ ifeq ($(uname_S),MINGW)
661659
NEEDS_CRYPTO_WITH_SSL = YesPlease
662660
NO_LIBGEN_H = YesPlease
663661
NO_POLL = YesPlease
664-
NO_SYMLINK_HEAD = YesPlease
665662
NO_SETENV = YesPlease
666663
NO_STRCASESTR = YesPlease
667664
NO_STRLCPY = YesPlease

configure.ac

-3
Original file line numberDiff line numberDiff line change
@@ -1195,9 +1195,6 @@ AC_COMPILE_IFELSE([BSD_SYSCTL_SRC],
11951195
GIT_CONF_SUBST([HAVE_BSD_SYSCTL])
11961196

11971197
## Other checks.
1198-
# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
1199-
# Enable it on Windows. By default, symrefs are still used.
1200-
#
12011198
# Define NO_PTHREADS if we do not have pthreads.
12021199
#
12031200
# Define PTHREAD_LIBS to the linker flag used for Pthread support.

refs/files-backend.c

-26
Original file line numberDiff line numberDiff line change
@@ -2044,24 +2044,6 @@ static int commit_ref_update(struct files_ref_store *refs,
20442044
return 0;
20452045
}
20462046

2047-
#ifdef NO_SYMLINK_HEAD
2048-
#define create_ref_symlink(a, b) (-1)
2049-
#else
2050-
static int create_ref_symlink(struct ref_lock *lock, const char *target)
2051-
{
2052-
int ret = -1;
2053-
2054-
char *ref_path = get_locked_file_path(&lock->lk);
2055-
unlink(ref_path);
2056-
ret = symlink(target, ref_path);
2057-
free(ref_path);
2058-
2059-
if (ret)
2060-
fprintf(stderr, "no symlink - falling back to symbolic ref\n");
2061-
return ret;
2062-
}
2063-
#endif
2064-
20652047
static int create_symref_lock(struct ref_lock *lock, const char *target,
20662048
struct strbuf *err)
20672049
{
@@ -3178,14 +3160,6 @@ static int files_transaction_finish(struct ref_store *ref_store,
31783160
}
31793161
}
31803162

3181-
/*
3182-
* We try creating a symlink, if that succeeds we continue to the
3183-
* next update. If not, we try and create a regular symref.
3184-
*/
3185-
if (update->new_target && refs->prefer_symlink_refs)
3186-
if (!create_ref_symlink(lock, update->new_target))
3187-
continue;
3188-
31893163
if (update->flags & REF_NEEDS_COMMIT) {
31903164
clear_loose_ref_cache(refs);
31913165
if (commit_ref(lock)) {

t/t0600-reffiles-backend.sh

-15
Original file line numberDiff line numberDiff line change
@@ -467,21 +467,6 @@ test_expect_success POSIXPERM 'git reflog expire honors core.sharedRepository' '
467467
esac
468468
'
469469

470-
test_expect_success SYMLINKS 'symref transaction supports symlinks' '
471-
test_when_finished "git symbolic-ref -d TEST_SYMREF_HEAD" &&
472-
git update-ref refs/heads/new @ &&
473-
test_config core.prefersymlinkrefs true &&
474-
cat >stdin <<-EOF &&
475-
start
476-
symref-create TEST_SYMREF_HEAD refs/heads/new
477-
prepare
478-
commit
479-
EOF
480-
git update-ref --no-deref --stdin <stdin &&
481-
test_path_is_symlink .git/TEST_SYMREF_HEAD &&
482-
test "$(test_readlink .git/TEST_SYMREF_HEAD)" = refs/heads/new
483-
'
484-
485470
test_expect_success 'symref transaction supports false symlink config' '
486471
test_when_finished "git symbolic-ref -d TEST_SYMREF_HEAD" &&
487472
git update-ref refs/heads/new @ &&

t/t7201-co.sh

-12
Original file line numberDiff line numberDiff line change
@@ -406,18 +406,6 @@ test_expect_success 'checkout w/--track from tag fails' '
406406
test "z$(git rev-parse main^0)" = "z$(git rev-parse HEAD)"
407407
'
408408

409-
test_expect_success 'detach a symbolic link HEAD' '
410-
git checkout main &&
411-
git config --bool core.prefersymlinkrefs yes &&
412-
git checkout side &&
413-
git checkout main &&
414-
it=$(git symbolic-ref HEAD) &&
415-
test "z$it" = zrefs/heads/main &&
416-
here=$(git rev-parse --verify refs/heads/main) &&
417-
git checkout side^ &&
418-
test "z$(git rev-parse --verify refs/heads/main)" = "z$here"
419-
'
420-
421409
test_expect_success 'checkout with --track fakes a sensible -b <name>' '
422410
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" &&
423411
git update-ref refs/remotes/origin/koala/bear renamer &&

t/t9903-bash-prompt.sh

-9
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,6 @@ test_expect_success 'prompt - branch name' '
4949
test_cmp expected "$actual"
5050
'
5151

52-
test_expect_success SYMLINKS 'prompt - branch name - symlink symref' '
53-
printf " (main)" >expected &&
54-
test_when_finished "git checkout main" &&
55-
test_config core.preferSymlinkRefs true &&
56-
git checkout main &&
57-
__git_ps1 >"$actual" &&
58-
test_cmp expected "$actual"
59-
'
60-
6152
test_expect_success 'prompt - unborn branch' '
6253
printf " (unborn)" >expected &&
6354
git checkout --orphan unborn &&

0 commit comments

Comments
 (0)