static gboolean ide_git_vcs_is_ignored (IdeVcs *vcs, GFile *file, GError **error) { g_autofree gchar *name = NULL; IdeGitVcs *self = (IdeGitVcs *)vcs; gboolean ret = FALSE; g_assert (IDE_IS_GIT_VCS (self)); g_assert (G_IS_FILE (file)); name = g_file_get_relative_path (self->working_directory, file); if (g_strcmp0 (name, ".git") == 0) return TRUE; if (name != NULL) return ggit_repository_path_is_ignored (self->repository, name, error); return ret; }
static gboolean ide_git_vcs_is_ignored (IdeVcs *vcs, GFile *file, GError **error) { g_autofree gchar *name = NULL; IdeGitVcs *self = (IdeGitVcs *)vcs; gboolean ret = FALSE; g_assert (IDE_IS_GIT_VCS (self)); g_assert (G_IS_FILE (file)); /* Note: this function is required to be thread-safe so that workers * can check if files are ignored from a thread without * round-tripping to the main thread. */ /* self->working_directory is not changed after creation, so safe * to access it from a thread. */ name = g_file_get_relative_path (self->working_directory, file); if (g_strcmp0 (name, ".git") == 0) return TRUE; /* * If we have a valid name to work with, we want to query the * repository. But this could be called from a thread, so ensure * we are the only thread accessing self->repository right now. */ if (name != NULL) { g_mutex_lock (&self->repository_mutex); ret = ggit_repository_path_is_ignored (self->repository, name, error); g_mutex_unlock (&self->repository_mutex); } return ret; }