Skip to content

Commit c49cf51

Browse files
authored
Remove editing PR body as part of creation (#292)
1 parent b598bdf commit c49cf51

3 files changed

Lines changed: 0 additions & 41 deletions

File tree

src/Stack/Commands/Helpers/Questions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public static class Questions
2020
public const string PullRequestStackDescription = "Stack description for pull request:";
2121
public const string OpenPullRequests = "Open new pull requests in a browser?";
2222
public const string CreatePullRequestAsDraft = "Create pull request as draft?";
23-
public const string EditPullRequestBody = "Edit pull request body? This will open a file in your default editor.";
2423
public const string ContinueOrAbortMerge = "Conflict(s) detected during merge. Please either resolve the conflicts, commit the result and select Continue to continue merging, or Abort.";
2524
public const string ContinueOrAbortRebase = "Conflict(s) detected during rebase. Please either resolve the conflicts and select Continue to continue rebasing, or Abort.";
2625
public const string ConfirmMigrateConfig = "Are you sure you want to migrate the configuration file to the latest version? This will create a backup of the current configuration file.";

src/Stack/Commands/PullRequests/CreatePullRequestsCommand.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ public override async Task Handle(CreatePullRequestsCommandInputs inputs)
123123
inputProvider,
124124
logger,
125125
gitClient,
126-
gitHubClient,
127126
fileOperations,
128127
selectedPullRequestActions);
129128

@@ -235,7 +234,6 @@ private static List<PullRequestInformation> GetPullRequestInformation(
235234
IInputProvider inputProvider,
236235
ILogger logger,
237236
IGitClient gitClient,
238-
IGitHubClient gitHubClient,
239237
IFileOperations fileOperations,
240238
List<PullRequestCreateAction> pullRequestCreateActions)
241239
{
@@ -272,11 +270,6 @@ private static List<PullRequestInformation> GetPullRequestInformation(
272270
273271
{StackConstants.StackMarkerEnd}");
274272

275-
if (inputProvider.Confirm(Questions.EditPullRequestBody))
276-
{
277-
gitClient.OpenFileInEditorAndWaitForClose(bodyFilePath);
278-
}
279-
280273
var draft = inputProvider.Confirm(Questions.CreatePullRequestAsDraft, false);
281274

282275
pullRequestActions.Add(new PullRequestInformation(

src/Stack/Git/GitClient.cs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public interface IGitClient
4646
string GetRemoteUri();
4747
string[] GetLocalBranchesOrderedByMostRecentCommitterDate();
4848
string GetRootOfRepository();
49-
void OpenFileInEditorAndWaitForClose(string path);
5049
string? GetConfigValue(string key);
5150
bool IsAncestor(string ancestor, string descendant);
5251
}
@@ -295,38 +294,6 @@ public bool IsAncestor(string ancestor, string descendant)
295294
return isAncestor;
296295
}
297296

298-
public void OpenFileInEditorAndWaitForClose(string path)
299-
{
300-
var editor = GetConfiguredEditor();
301-
if (string.IsNullOrWhiteSpace(editor))
302-
{
303-
logger.Error("No editor is configured in git. Please configure an editor using 'git config --global core.editor <editor>'.");
304-
return;
305-
}
306-
307-
var editorSplit = editor.Split(' ');
308-
var editorFileName = editorSplit[0];
309-
var editorArguments = editorSplit.Length > 1 ? string.Join(' ', editorSplit.Skip(1)) : string.Empty;
310-
311-
var processStartInfo = new ProcessStartInfo
312-
{
313-
FileName = editorFileName,
314-
Arguments = $"\"{path}\" {editorArguments}",
315-
UseShellExecute = true,
316-
CreateNoWindow = true
317-
};
318-
319-
var process = Process.Start(processStartInfo);
320-
321-
if (process == null)
322-
{
323-
logger.Error("Failed to start editor process.");
324-
return;
325-
}
326-
327-
process.WaitForExit();
328-
}
329-
330297
private string ExecuteGitCommandAndReturnOutput(
331298
string command,
332299
bool captureStandardError = false,

0 commit comments

Comments
 (0)