1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-21 22:32:41 +01:00

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
This commit is contained in:
nevogd 2015-03-06 04:41:00 -08:00 committed by epriestley
parent c36b4ceb18
commit 3d871b4214

View file

@ -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);