예제 #1
0
        public async Task <bool?> CheckForUpdateAsync(string repoPath)
        {
            if (_cache == null)
            {
                await BuildCacheAsync();
            }

            var template = _cache.SingleOrDefault(t => t.RemoteUrl == repoPath);

            if (template == null)
            {
                return(null);
            }

            await _gitClient.FetchAsync(template.LocalFolderPath);

            template.ClonedLastUpdate = await _gitClient.GetLastCommitDateAsync(template.LocalFolderPath);

            template.RemoteLastUpdate = await _gitClient.GetLastCommitDateAsync(template.LocalFolderPath, "origin/master");

            if (template.RemoteLastUpdate.HasValue && template.ClonedLastUpdate.HasValue)
            {
                var span = template.RemoteLastUpdate - template.ClonedLastUpdate;
            }

            return(template.UpdateAvailable);
        }