Permalink
Browse files

Fixed updating submodules recursive when having multiple submodules

  • Loading branch information...
1 parent f02510b commit 7ad3dc193904289fded768badd7e26e6448a3df0 @spdr870 spdr870 committed Aug 3, 2009
Showing with 65 additions and 33 deletions.
  1. +1 −1 GitUI/AboutBox.Designer.cs
  2. +30 −13 GitUI/Browse.cs
  3. +18 −17 GitUI/FormClone.cs
  4. +13 −2 GitUI/FormVerify.cs
  5. +3 −0 GitUI/Resources/ChangeLog.txt

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -846,13 +846,18 @@ private static void UpdateSubmodulesRecursive()
foreach (GitSubmodule submodule in GitCommands.GitCommands.GetSubmodules())
{
- Settings.WorkingDir = oldworkingdir + submodule.LocalPath;
-
- if (File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
+ if (!string.IsNullOrEmpty(submodule.LocalPath))
{
- FormProcess process = new FormProcess(GitCommands.GitCommands.SubmoduleUpdateCmd(""));
+ Settings.WorkingDir = oldworkingdir + submodule.LocalPath;
+
+ if (Settings.WorkingDir != oldworkingdir && File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
+ {
+ FormProcess process = new FormProcess(GitCommands.GitCommands.SubmoduleUpdateCmd(""));
- UpdateSubmodulesRecursive();
+ UpdateSubmodulesRecursive();
+ }
+
+ Settings.WorkingDir = oldworkingdir;
}
}
@@ -879,12 +884,18 @@ private static void InitSubmodulesRecursive()
foreach (GitSubmodule submodule in GitCommands.GitCommands.GetSubmodules())
{
- Settings.WorkingDir = oldworkingdir + submodule.LocalPath;
- if (File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
+ if (!string.IsNullOrEmpty(submodule.LocalPath))
{
- FormProcess process = new FormProcess(GitCommands.GitCommands.SubmoduleInitCmd(""));
+ Settings.WorkingDir = oldworkingdir + submodule.LocalPath;
+
+ if (Settings.WorkingDir != oldworkingdir && File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
+ {
+ FormProcess process = new FormProcess(GitCommands.GitCommands.SubmoduleInitCmd(""));
- InitSubmodulesRecursive();
+ InitSubmodulesRecursive();
+ }
+
+ Settings.WorkingDir = oldworkingdir;
}
}
@@ -911,12 +922,18 @@ private static void SyncSubmodulesRecursive()
foreach (GitSubmodule submodule in GitCommands.GitCommands.GetSubmodules())
{
- Settings.WorkingDir = oldworkingdir + submodule.LocalPath;
- if (File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
+ if (!string.IsNullOrEmpty(submodule.LocalPath))
{
- FormProcess process = new FormProcess(GitCommands.GitCommands.SubmoduleSyncCmd(""));
+ Settings.WorkingDir = oldworkingdir + submodule.LocalPath;
+
+ if (Settings.WorkingDir != oldworkingdir && File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
+ {
+ FormProcess process = new FormProcess(GitCommands.GitCommands.SubmoduleSyncCmd(""));
+
+ SyncSubmodulesRecursive();
+ }
- SyncSubmodulesRecursive();
+ Settings.WorkingDir = oldworkingdir;
}
}
View
@@ -48,24 +48,20 @@ private void Ok_Click(object sender, EventArgs e)
{
if (this.ShowInTaskbar == false)
{
- if (File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
+ if (MessageBox.Show("The repository has been cloned successfully." + Environment.NewLine + "Do you want to open the new repository \"" + dirTo + "\" now?", "Open", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
- string oldWorkingdir = GitCommands.Settings.WorkingDir;
-
GitCommands.Settings.WorkingDir = dirTo;
- if (MessageBox.Show("The cloned has submodules configured." + Environment.NewLine + "Do you want to initialize the submodules?" + Environment.NewLine + Environment.NewLine + "This will initialize and update all submodules recursive.", "Submodules", MessageBoxButtons.YesNo) == DialogResult.Yes)
+ if (File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
{
- FormProcess process = new FormProcess(GitCommands.GitCommands.SubmoduleInitCmd(""));
- InitializeSubmodulesRecursive();
+ if (MessageBox.Show("The cloned has submodules configured." + Environment.NewLine + "Do you want to initialize the submodules?" + Environment.NewLine + Environment.NewLine + "This will initialize and update all submodules recursive.", "Submodules", MessageBoxButtons.YesNo) == DialogResult.Yes)
+ {
+ FormProcess process = new FormProcess(GitCommands.GitCommands.SubmoduleInitCmd(""));
+ InitializeSubmodulesRecursive();
+ }
+
}
- GitCommands.Settings.WorkingDir = oldWorkingdir;
- }
-
- if (MessageBox.Show("The repository has been cloned successfully." + Environment.NewLine + "Do you want to open the new repository \"" + dirTo + "\" now?", "Open", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- GitCommands.Settings.WorkingDir = dirTo;
}
}
Close();
@@ -82,13 +78,18 @@ private static void InitializeSubmodulesRecursive()
foreach (GitSubmodule submodule in GitCommands.GitCommands.GetSubmodules())
{
- Settings.WorkingDir = oldworkingdir + submodule.LocalPath;
-
- if (File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
+ if (!string.IsNullOrEmpty(submodule.LocalPath))
{
- FormProcess process = new FormProcess(GitCommands.GitCommands.SubmoduleInitCmd(""));
+ Settings.WorkingDir = oldworkingdir + submodule.LocalPath;
+
+ if (Settings.WorkingDir != oldworkingdir && File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
+ {
+ FormProcess process = new FormProcess(GitCommands.GitCommands.SubmoduleInitCmd(""));
+
+ InitializeSubmodulesRecursive();
+ }
- InitializeSubmodulesRecursive();
+ Settings.WorkingDir = oldworkingdir;
}
}
View
@@ -66,7 +66,18 @@ private string ExtendWarning(string warning)
private void button1_Click(object sender, EventArgs e)
{
- FormProcess process = new FormProcess("fsck-objects --lost-found");
+ string options = "";
+
+ if (Unreachable.Checked)
+ options += " --unreachable";
+
+ if (FullCheck.Checked)
+ options += " --full";
+
+ if (NoReflogs.Checked)
+ options += " --no-reflogs";
+
+ FormProcess process = new FormProcess("fsck-objects --lost-found" + options);
FormVerify_Shown(null, null);
}
@@ -95,7 +106,7 @@ private string FindSha1(string warningString)
private void Remove_Click(object sender, EventArgs e)
{
- if (MessageBox.Show("Are you sure you want to delete dangling objects?", "Remove", MessageBoxButtons.YesNo) == DialogResult.Yes)
+ if (MessageBox.Show("Are you sure you want to delete all dangling objects?", "Remove", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
new FormProcess("prune");
FormVerify_Shown(null, null);
@@ -1,6 +1,9 @@
Changelog
=========
+Version 1.69
+ Fixed updating submodules recursive when having multiple submodules
+
Version 1.68
Improved 'Recover lost objects' dialog. Now all lost objects can be found and finding a specific commit should be much easier now.
Use Environment.NewLine instead of "\n".

0 comments on commit 7ad3dc1

Please sign in to comment.