mirror of
https://github.com/haiwen/seafile.git
synced 2025-01-07 03:17:13 +08:00
Ignore checkout . and .. (#2841)
Co-authored-by: yangheran <heran.yang@seafile.com>
This commit is contained in:
parent
6e2ad478ac
commit
a5ae65086a
23
lib/utils.c
23
lib/utils.c
@ -806,6 +806,13 @@ should_ignore_on_checkout (const char *file_path, IgnoreReason *ignore_reason)
|
||||
for (; j < n_comps; ++j) {
|
||||
file_name = components[j];
|
||||
|
||||
if (g_strcmp0(file_name, ".") == 0 || g_strcmp0(file_name, "..") == 0) {
|
||||
if (ignore_reason)
|
||||
*ignore_reason = IGNORE_REASON_INVALID_CHARACTER;
|
||||
ret = TRUE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (has_trailing_space_or_period (file_name)) {
|
||||
/* Ignore files/dir whose path has trailing spaces. It would cause
|
||||
* problem on windows. */
|
||||
@ -839,6 +846,22 @@ out:
|
||||
g_strfreev (components);
|
||||
#endif
|
||||
|
||||
char **components = g_strsplit (file_path, "/", -1);
|
||||
int n_comps = g_strv_length (components);
|
||||
int j = 0;
|
||||
char *file_name;
|
||||
|
||||
for (; j < n_comps; ++j) {
|
||||
file_name = components[j];
|
||||
if (g_strcmp0(file_name, ".") == 0 || g_strcmp0(file_name, "..") == 0) {
|
||||
ret = TRUE;
|
||||
if (ignore_reason)
|
||||
*ignore_reason = IGNORE_REASON_INVALID_CHARACTER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_strfreev (components);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user