Skip to content

Commit a1fae71

Browse files
author
Andrew
committed
Fixed cred spam
Fixed git / git-lfs fail links
1 parent eb25cf5 commit a1fae71

File tree

6 files changed

+43
-15
lines changed

6 files changed

+43
-15
lines changed

GitItGUI.Core/AppManager.cs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,22 @@ private static bool IsValidVersion(string currentVersion, string requiredVersion
304304
return false;
305305
}
306306

307+
private static void DownloadGit()
308+
{
309+
using (var process = Process.Start("https://git-scm.com/downloads"))
310+
{
311+
process.WaitForExit();
312+
}
313+
}
314+
315+
private static void DownloadGitLFS()
316+
{
317+
using (var process = Process.Start("https://git-lfs.github.com/"))
318+
{
319+
process.WaitForExit();
320+
}
321+
}
322+
307323
private static void Client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
308324
{
309325
if (e.Error != null)
@@ -337,6 +353,7 @@ private static void Client_DownloadStringCompleted(object sender, DownloadString
337353
Debug.LogError("git is not installed correctly. (Make sure git is usable in the cmd/terminal)", true);
338354
client.Dispose();
339355
if (checkForUpdatesCallback != null) checkForUpdatesCallback(false, true);
356+
DownloadGit();
340357
return;
341358
}
342359

@@ -349,6 +366,7 @@ private static void Client_DownloadStringCompleted(object sender, DownloadString
349366
Debug.LogError("git-lfs is not installed correctly. (Make sure git-lfs is usable in the cmd/terminal)", true);
350367
client.Dispose();
351368
if (checkForUpdatesCallback != null) checkForUpdatesCallback(false, true);
369+
DownloadGitLFS();
352370
return;
353371
}
354372

@@ -382,6 +400,8 @@ private static void Client_DownloadStringCompleted(object sender, DownloadString
382400
Debug.LogError(string.Format("'git-lfs' version is not compatible with 'git' version installed!"), true);
383401
client.Dispose();
384402
if (checkForUpdatesCallback != null) checkForUpdatesCallback(false, true);
403+
DownloadGit();
404+
DownloadGitLFS();
385405
return;
386406
}
387407

@@ -413,10 +433,7 @@ private static void Client_DownloadStringCompleted(object sender, DownloadString
413433
if (!IsValidVersion(gitVersion, xmlReader.ReadInnerXml()))
414434
{
415435
Debug.LogError("Your 'git' version is out of date.\nDownload and install with defaults!", true);
416-
using (var process = Process.Start("https://git-scm.com/downloads"))
417-
{
418-
process.WaitForExit();
419-
}
436+
DownloadGit();
420437
}
421438
}
422439

@@ -432,10 +449,7 @@ private static void Client_DownloadStringCompleted(object sender, DownloadString
432449
if (!IsValidVersion(gitlfsVersion, xmlReader.ReadInnerXml()))
433450
{
434451
Debug.LogError("Your 'git-lfs' version is out of date.\nDownload and install with defaults!", true);
435-
using (var process = Process.Start("https://git-lfs.github.com/"))
436-
{
437-
process.WaitForExit();
438-
}
452+
DownloadGitLFS();
439453
}
440454
}
441455

GitItGUI.Core/RepoManager.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static class RepoManager
5555
/// </summary>
5656
/// <param name="path">Path to git repo</param>
5757
/// <returns>True if succeeded</returns>
58-
public static bool OpenRepo(string path)
58+
public static bool OpenRepo(string path, bool checkForSettingErros = false)
5959
{
6060
// unload repo
6161
if (string.IsNullOrEmpty(path))
@@ -122,9 +122,12 @@ public static bool OpenRepo(string path)
122122
AppManager.AddActiveRepoToHistory();
123123

124124
// warnings
125-
if (userSettings.signatureName.Contains("TODO: ") || userSettings.signatureEmail.Contains("TODO: ") || userSettings.username.Contains("TODO: "))
125+
if (checkForSettingErros)
126126
{
127-
Debug.LogWarning("Credentials not set, please go to the settings tab!", true);
127+
if (userSettings.signatureName.Contains("TODO: ") || userSettings.signatureEmail.Contains("TODO: ") || userSettings.username.Contains("TODO: "))
128+
{
129+
Debug.LogWarning("Credentials not set, please go to the settings tab!", true);
130+
}
128131
}
129132
}
130133
catch (Exception e)

GitItGUI/ChangesPage.xaml.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,20 +406,31 @@ private bool ChangesManager_AskUserIfTheyAcceptMergedFileCallback(FileState file
406406
return true;
407407
}
408408

409+
private void CheckLocalBranchSyncErrors()
410+
{
411+
if (BranchManager.IsTracking()) return;
412+
413+
414+
}
415+
409416
private void PushChangesButton_Advanced_Click(object sender, RoutedEventArgs e)
410417
{
418+
CheckLocalBranchSyncErrors();
411419
ProcessingPage.singleton.mode = ProcessingPageModes.Push;
412420
MainWindow.LoadPage(PageTypes.Processing);
413421
}
414422

415423
private void PullChangesButton_Advanced_Click(object sender, RoutedEventArgs e)
416424
{
425+
CheckLocalBranchSyncErrors();
417426
ProcessingPage.singleton.mode = ProcessingPageModes.Pull;
418427
MainWindow.LoadPage(PageTypes.Processing);
419428
}
420429

421430
private void SyncChangesButton_Click(object sender, RoutedEventArgs e)
422431
{
432+
CheckLocalBranchSyncErrors();
433+
423434
// check if files need to be staged
424435
if (ChangesManager.FilesAreUnstaged())
425436
{

GitItGUI/MainContent.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private void RepoManager_RepoRefreshedCallback()
6262
private void RepoManager_RepoRefreshedCallback_UIThread()
6363
{
6464
string name = RepoManager.repoPath;
65-
if (!string.IsNullOrEmpty(name)) repoName.Text = name.Substring(Path.GetDirectoryName(name).Length + 1);
65+
if (!string.IsNullOrEmpty(name)) repoName.Text = string.Format("{0} ({1})", name.Substring(Path.GetDirectoryName(name).Length + 1), BranchManager.activeBranch.FriendlyName);
6666
else repoName.Text = "";
6767
}
6868

GitItGUI/ProcessingPage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private void Process()
160160
RepoManager.SaveSettings(clonePath);
161161

162162
// open repo
163-
if (!RepoManager.OpenRepo(clonePath))
163+
if (!RepoManager.OpenRepo(clonePath, true))
164164
{
165165
MessageBox.Show("Failed to open repo: " + clonePath);
166166
MainWindow.LoadPage(PageTypes.Start);

GitItGUI/StartPage.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private async void OpenButton_Click(object sender, RoutedEventArgs e)
7777
}
7878

7979
// open repo
80-
if (!RepoManager.OpenRepo(path))
80+
if (!RepoManager.OpenRepo(path, true))
8181
{
8282
MessageBox.Show("Failed to open repo: " + path);
8383
grid.IsVisible = true;
@@ -96,7 +96,7 @@ private void RecentButton_Click(object sender, RoutedEventArgs e)
9696
string path = (string)button.Content;
9797

9898
// open repo
99-
if (!RepoManager.OpenRepo(path))
99+
if (!RepoManager.OpenRepo(path, true))
100100
{
101101
// remove bad repo from list
102102
MessageBox.Show("Failed to open repo: " + path);

0 commit comments

Comments
 (0)