From 1d718a5108f905e3c64f9fa791e67a52bd926457 Mon Sep 17 00:00:00 2001 From: Clemens Buchacher Date: Sun, 20 Feb 2011 13:13:43 +0100 Subject: 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 Signed-off-by: Junio C Hamano --- symlinks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'symlinks.c') diff --git a/symlinks.c b/symlinks.c index 3cacebd91a..034943bda0 100644 --- a/symlinks.c +++ b/symlinks.c @@ -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; -- cgit v1.2.3