Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -490,13 +491,13 @@ private void configureGitBashProfile(Path settingsPath, String bashPath) throws
ObjectNode gitBashProfile = mapper.createObjectNode();
String newGuid = "{2ece5bfe-50ed-5f3a-ab87-5cd4baafed2b}";
String iconPath = getGitBashIconPath(bashPath);
String startingDirectory = this.context.getIdeRoot().toString();
Path startingDirectory = Objects.requireNonNullElse(this.context.getIdeRoot(), this.context.getUserHome());

gitBashProfile.put("guid", newGuid);
gitBashProfile.put("name", "Git Bash");
gitBashProfile.put("commandline", bashPath);
gitBashProfile.put("icon", iconPath);
gitBashProfile.put("startingDirectory", startingDirectory);
gitBashProfile.put("startingDirectory", startingDirectory.toString());

((ArrayNode) profilesList).add(gitBashProfile);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,22 @@ void testInstallIdeasy(String os) {
+ addedRcLines);
}

/** Test of {@link IdeasyCommandlet#configureWindowsTerminalGitBash()}. */
@Test
void testConfigureWindowsTerminalGitBash() {
/**
* Test of {@link IdeasyCommandlet#configureWindowsTerminalGitBash()}, also when {@code IDE_ROOT} is not yet set, as is the case during MSI installation.
*
* @param ideRootSet whether {@code IDE_ROOT} is set on the context.
*/
@ParameterizedTest
@ValueSource(booleans = { true, false })
void testConfigureWindowsTerminalGitBash(boolean ideRootSet) {

// arrange
SystemInfo systemInfo = SystemInfoMock.of("windows");
IdeTestContext context = newContext("install");
context.setSystemInfo(systemInfo);
if (!ideRootSet) {
context.setIdeRoot(null);
}
IdeasyCommandlet ideasy = new IdeasyCommandlet(context);

// act
Expand Down
Loading