Skip to content

Commit d998b2f

Browse files
committed
create_symref: drop support for writing symbolic links
The parent commit deprecated the writing of symbolic links for symrefs. Now that some time has passed, we can follow through by dropping the code. Signed-off-by: Jeff King <[email protected]>
1 parent b2826b5 commit d998b2f

File tree

7 files changed

+0
-115
lines changed

7 files changed

+0
-115
lines changed

Makefile

Lines changed: 0 additions & 6 deletions
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.
@@ -1928,9 +1925,6 @@ endif
19281925
ifdef OPEN_RETURNS_EINTR
19291926
COMPAT_CFLAGS += -DOPEN_RETURNS_EINTR
19301927
endif
1931-
ifdef NO_SYMLINK_HEAD
1932-
BASIC_CFLAGS += -DNO_SYMLINK_HEAD
1933-
endif
19341928
ifdef NO_GETTEXT
19351929
BASIC_CFLAGS += -DNO_GETTEXT
19361930
USE_GETTEXT_SCHEME ?= fallthrough

config.mak.uname

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ ifeq ($(uname_O),Cygwin)
247247
NO_D_TYPE_IN_DIRENT = YesPlease
248248
NO_STRCASESTR = YesPlease
249249
NO_MEMMEM = YesPlease
250-
NO_SYMLINK_HEAD = YesPlease
251250
NO_IPV6 = YesPlease
252251
OLD_ICONV = UnfortunatelyYes
253252
# There are conflicting reports about this.
@@ -460,7 +459,6 @@ ifeq ($(uname_S),Windows)
460459
NEEDS_CRYPTO_WITH_SSL = YesPlease
461460
NO_LIBGEN_H = YesPlease
462461
NO_POLL = YesPlease
463-
NO_SYMLINK_HEAD = YesPlease
464462
NO_IPV6 = YesPlease
465463
NO_SETENV = YesPlease
466464
NO_STRCASESTR = YesPlease
@@ -675,7 +673,6 @@ ifeq ($(uname_S),MINGW)
675673
NEEDS_CRYPTO_WITH_SSL = YesPlease
676674
NO_LIBGEN_H = YesPlease
677675
NO_POLL = YesPlease
678-
NO_SYMLINK_HEAD = YesPlease
679676
NO_SETENV = YesPlease
680677
NO_STRCASESTR = YesPlease
681678
NO_STRLCPY = YesPlease

configure.ac

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,9 +1223,6 @@ if test -z "$HAVE_BSD_SYSCTL"; then
12231223
fi
12241224

12251225
## Other checks.
1226-
# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
1227-
# Enable it on Windows. By default, symrefs are still used.
1228-
#
12291226
# Define NO_PTHREADS if we do not have pthreads.
12301227
#
12311228
# Define PTHREAD_LIBS to the linker flag used for Pthread support.

refs/files-backend.c

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,39 +2094,6 @@ static int commit_ref_update(struct files_ref_store *refs,
20942094
return 0;
20952095
}
20962096

2097-
#if defined(NO_SYMLINK_HEAD) || defined(WITH_BREAKING_CHANGES)
2098-
#define create_ref_symlink(a, b) (-1)
2099-
#else
2100-
static int create_ref_symlink(struct ref_lock *lock, const char *target)
2101-
{
2102-
static int warn_once = 1;
2103-
char *ref_path;
2104-
int ret = -1;
2105-
2106-
ref_path = get_locked_file_path(&lock->lk);
2107-
unlink(ref_path);
2108-
ret = symlink(target, ref_path);
2109-
free(ref_path);
2110-
2111-
if (ret)
2112-
fprintf(stderr, "no symlink - falling back to symbolic ref\n");
2113-
2114-
if (warn_once)
2115-
warning(_("'core.preferSymlinkRefs=true' is nominated for removal.\n"
2116-
"hint: The use of symbolic links for symbolic refs is deprecated\n"
2117-
"hint: and will be removed in Git 3.0. The configuration that\n"
2118-
"hint: tells Git to use them is thus going away. You can unset\n"
2119-
"hint: it with:\n"
2120-
"hint:\n"
2121-
"hint:\tgit config unset core.preferSymlinkRefs\n"
2122-
"hint:\n"
2123-
"hint: Git will then use the textual symref format instead."));
2124-
warn_once = 0;
2125-
2126-
return ret;
2127-
}
2128-
#endif
2129-
21302097
static int create_symref_lock(struct ref_lock *lock, const char *target,
21312098
struct strbuf *err)
21322099
{
@@ -3308,20 +3275,6 @@ static int files_transaction_finish(struct ref_store *ref_store,
33083275
}
33093276
}
33103277

3311-
/*
3312-
* We try creating a symlink, if that succeeds we continue to the
3313-
* next update. If not, we try and create a regular symref.
3314-
*/
3315-
if (update->new_target && refs->prefer_symlink_refs)
3316-
/*
3317-
* By using the `NOT_CONSTANT()` trick, we can avoid
3318-
* errors by `clang`'s `-Wunreachable` logic that would
3319-
* report that the `continue` statement is not reachable
3320-
* when `NO_SYMLINK_HEAD` is `#define`d.
3321-
*/
3322-
if (NOT_CONSTANT(!create_ref_symlink(lock, update->new_target)))
3323-
continue;
3324-
33253278
if (update->flags & REF_NEEDS_COMMIT) {
33263279
clear_loose_ref_cache(refs);
33273280
if (commit_ref(lock)) {

t/t0600-reffiles-backend.sh

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -467,41 +467,6 @@ test_expect_success POSIXPERM 'git reflog expire honors core.sharedRepository' '
467467
esac
468468
'
469469

470-
test_expect_success SYMLINKS,!MINGW '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 2>err &&
481-
if test_have_prereq WITH_BREAKING_CHANGES
482-
then
483-
test_path_is_file .git/TEST_SYMREF_HEAD &&
484-
echo "ref: refs/heads/new" >expect &&
485-
test_cmp expect .git/TEST_SYMREF_HEAD &&
486-
test_must_be_empty err
487-
else
488-
test_path_is_symlink .git/TEST_SYMREF_HEAD &&
489-
test "$(test_readlink .git/TEST_SYMREF_HEAD)" = refs/heads/new &&
490-
cat >expect <<-EOF &&
491-
warning: ${SQ}core.preferSymlinkRefs=true${SQ} is nominated for removal.
492-
hint: The use of symbolic links for symbolic refs is deprecated
493-
hint: and will be removed in Git 3.0. The configuration that
494-
hint: tells Git to use them is thus going away. You can unset
495-
hint: it with:
496-
hint:
497-
hint: git config unset core.preferSymlinkRefs
498-
hint:
499-
hint: Git will then use the textual symref format instead.
500-
EOF
501-
test_cmp expect err
502-
fi
503-
'
504-
505470
test_expect_success 'symref transaction supports false symlink config' '
506471
test_when_finished "git symbolic-ref -d TEST_SYMREF_HEAD" &&
507472
git update-ref refs/heads/new @ &&

t/t7201-co.sh

Lines changed: 0 additions & 12 deletions
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

Lines changed: 0 additions & 9 deletions
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)