Skip to content

Commit

Permalink
fsck: demote the newly-introduced symlink issues from WARN -> IGNORE
Browse files Browse the repository at this point in the history
The idea of the symlink check to prevent overly-long symlink targets and
targets inside the `.git/` directory was to _warn_, but not to prevent
any operation.

However, that's not how Git works, I was confused by the label `WARN`.
What we need instead is the `IGNORE` label, which still warns
(confusingly so ;-)), but does not prevent any operations from
continuing.

Adjust t1450 accordingly, documenting that `git fsck` unfortunately no
longer warns about these issues by default.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed May 29, 2024
1 parent 47b6d90 commit fdc78a6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Documentation/fsck-msgids.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@
(WARN) Tree contains entries pointing to a null sha1.

`symlinkPointsToGitDir`::
(WARN) Symbolic link points inside a gitdir.
(INFO) Symbolic link points inside a gitdir.

`symlinkTargetBlob`::
(ERROR) A non-blob found instead of a symbolic link's target.

`symlinkTargetLength`::
(WARN) Symbolic link target longer than maximum path length.
(INFO) Symbolic link target longer than maximum path length.

`symlinkTargetMissing`::
(ERROR) Unable to read symbolic link target's blob.
Expand Down
4 changes: 2 additions & 2 deletions fsck.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ enum fsck_msg_type {
FUNC(NULL_SHA1, WARN) \
FUNC(ZERO_PADDED_FILEMODE, WARN) \
FUNC(NUL_IN_COMMIT, WARN) \
FUNC(SYMLINK_TARGET_LENGTH, WARN) \
FUNC(SYMLINK_POINTS_TO_GIT_DIR, WARN) \
/* infos (reported as warnings, but ignored by default) */ \
FUNC(BAD_FILEMODE, INFO) \
FUNC(GITMODULES_PARSE, INFO) \
Expand All @@ -84,6 +82,8 @@ enum fsck_msg_type {
FUNC(MAILMAP_SYMLINK, INFO) \
FUNC(BAD_TAG_NAME, INFO) \
FUNC(MISSING_TAGGER_ENTRY, INFO) \
FUNC(SYMLINK_TARGET_LENGTH, INFO) \
FUNC(SYMLINK_POINTS_TO_GIT_DIR, INFO) \
/* ignored (elevated when requested) */ \
FUNC(EXTRA_HEADER_ENTRY, IGNORE)

Expand Down
13 changes: 12 additions & 1 deletion t/t1450-fsck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,18 @@ test_expect_success 'fsck warning on symlink target with excessive length' '
warning in blob $symlink_target: symlinkTargetLength: symlink target too long
EOF
git fsck --no-dangling >actual 2>&1 &&
test_cmp expected actual
test_cmp expected actual &&
test_when_finished "git tag -d symlink-target-length" &&
git tag symlink-target-length $tree &&
test_when_finished "rm -rf throwaway.git" &&
git init --bare throwaway.git &&
git --git-dir=throwaway.git config receive.fsckObjects true &&
git --git-dir=throwaway.git config receive.fsck.symlinkTargetLength error &&
test_must_fail git push throwaway.git symlink-target-length &&
git --git-dir=throwaway.git config --unset receive.fsck.symlinkTargetLength &&
git push throwaway.git symlink-target-length 2>err &&
grep "warning.*symlinkTargetLength" err
'

test_expect_success 'fsck warning on symlink target pointing inside git dir' '
Expand Down

0 comments on commit fdc78a6

Please sign in to comment.