Skip to content

Commit

Permalink
Fixed updating submodules recursive when having multiple submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
spdr870 committed Aug 3, 2009
1 parent f02510b commit 7ad3dc1
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 33 deletions.
2 changes: 1 addition & 1 deletion GitUI/AboutBox.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 30 additions & 13 deletions GitUI/Browse.cs
Expand Up @@ -846,13 +846,18 @@ private static void UpdateSubmodulesRecursive()


foreach (GitSubmodule submodule in GitCommands.GitCommands.GetSubmodules()) foreach (GitSubmodule submodule in GitCommands.GitCommands.GetSubmodules())
{ {
Settings.WorkingDir = oldworkingdir + submodule.LocalPath; if (!string.IsNullOrEmpty(submodule.LocalPath))

if (File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
{ {
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;
} }
} }


Expand All @@ -879,12 +884,18 @@ private static void InitSubmodulesRecursive()


foreach (GitSubmodule submodule in GitCommands.GitCommands.GetSubmodules()) foreach (GitSubmodule submodule in GitCommands.GitCommands.GetSubmodules())
{ {
Settings.WorkingDir = oldworkingdir + submodule.LocalPath; if (!string.IsNullOrEmpty(submodule.LocalPath))
if (File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
{ {
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;
} }
} }


Expand All @@ -911,12 +922,18 @@ private static void SyncSubmodulesRecursive()


foreach (GitSubmodule submodule in GitCommands.GitCommands.GetSubmodules()) foreach (GitSubmodule submodule in GitCommands.GitCommands.GetSubmodules())
{ {
Settings.WorkingDir = oldworkingdir + submodule.LocalPath; if (!string.IsNullOrEmpty(submodule.LocalPath))
if (File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
{ {
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;
} }
} }


Expand Down
35 changes: 18 additions & 17 deletions GitUI/FormClone.cs
Expand Up @@ -48,24 +48,20 @@ private void Ok_Click(object sender, EventArgs e)
{ {
if (this.ShowInTaskbar == false) 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; 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("")); 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)
InitializeSubmodulesRecursive(); {
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(); Close();
Expand All @@ -82,13 +78,18 @@ private static void InitializeSubmodulesRecursive()


foreach (GitSubmodule submodule in GitCommands.GitCommands.GetSubmodules()) foreach (GitSubmodule submodule in GitCommands.GitCommands.GetSubmodules())
{ {
Settings.WorkingDir = oldworkingdir + submodule.LocalPath; if (!string.IsNullOrEmpty(submodule.LocalPath))

if (File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
{ {
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;
} }
} }


Expand Down
15 changes: 13 additions & 2 deletions GitUI/FormVerify.cs
Expand Up @@ -66,7 +66,18 @@ private string ExtendWarning(string warning)


private void button1_Click(object sender, EventArgs e) 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); FormVerify_Shown(null, null);
} }


Expand Down Expand Up @@ -95,7 +106,7 @@ private string FindSha1(string warningString)


private void Remove_Click(object sender, EventArgs e) 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"); new FormProcess("prune");
FormVerify_Shown(null, null); FormVerify_Shown(null, null);
Expand Down
3 changes: 3 additions & 0 deletions GitUI/Resources/ChangeLog.txt
@@ -1,6 +1,9 @@
Changelog Changelog
========= =========


Version 1.69
Fixed updating submodules recursive when having multiple submodules

Version 1.68 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. 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". Use Environment.NewLine instead of "\n".
Expand Down

0 comments on commit 7ad3dc1

Please sign in to comment.