From 3d871b42146ee98a18b6f71589a8ac8bbac77022 Mon Sep 17 00:00:00 2001 From: nevogd Date: Fri, 6 Mar 2015 04:41:00 -0800 Subject: [PATCH] Add untracked files to commit using prompt Summary: Refs D11990. When using `arc diff` with untracked files in the working copy, add the untracked file(s) to the commit (as they weren't stashed or ignored). Add the untracked paths to the list of changes in the editor template, indicating that the files were added to the commit. This doesn't add a separate prompt to add untracked files as per the behaviour prior to D11843. Test Plan: Ran `arc diff` with only untracked files, answered yes to the 'create new commit' prompt. Saw the commit-message with the updated changes including untracked files. Completed the arc template, and got commit containing uncommitted, unstaged and untracked files. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11995 --- src/workflow/ArcanistWorkflow.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php index 03a7d3b2..b35673c8 100644 --- a/src/workflow/ArcanistWorkflow.php +++ b/src/workflow/ArcanistWorkflow.php @@ -932,8 +932,12 @@ abstract class ArcanistWorkflow extends Phobject { echo implode("\n\n", $lists)."\n"; - $all_uncommitted = array_merge($unstaged, $uncommitted); + $all_uncommitted = array_merge($untracked, $unstaged, $uncommitted); if ($this->askForAdd($all_uncommitted)) { + if ($untracked) { + $api->addToCommit($untracked); + } + if ($unstaged) { $api->addToCommit($unstaged); } @@ -976,6 +980,10 @@ abstract class ArcanistWorkflow extends Phobject { "# ".pht('Enter a commit message.')."\n#\n". "# ".pht('Changes:')."\n#\n"; + foreach ($untracked as $untracked_path) { + $template .= "# ".$untracked_path." (".pht('Added').")\n"; + } + $paths = array_merge($uncommitted, $unstaged); $paths = array_unique($paths); sort($paths); -- 2.43.0