mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
do not overwrite untracked symlinks
Git traditionally overwrites untracked symlinks silently. This will generally not cause massive data loss, but it is inconsistent with the behavior for regular files, which are not silently overwritten. With this change, git refuses to overwrite untracked symlinks by default. If the user really wants to overwrite the untracked symlink, he has git-clean and git-checkout -f at his disposal. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
2fe26b775c
commit
1d718a5108
@@ -223,7 +223,7 @@ int check_leading_path(const char *name, int len)
|
||||
int flags;
|
||||
int match_len = lstat_cache_matchlen(cache, name, len, &flags,
|
||||
FL_SYMLINK|FL_NOENT|FL_DIR, USE_ONLY_LSTAT);
|
||||
if (flags & (FL_SYMLINK|FL_NOENT))
|
||||
if (flags & FL_NOENT)
|
||||
return 0;
|
||||
else if (flags & FL_DIR)
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user