]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix arc commit workflow when new directories were added.
authorMarek Sapota <mareksapota@fb.com>
Fri, 9 Dec 2011 23:58:13 +0000 (15:58 -0800)
committerMarek Sapota <mareksapota@fb.com>
Sat, 10 Dec 2011 00:06:47 +0000 (16:06 -0800)
Summary: This adds parent directories of modified files to commit paths if
needed.

Test Plan:
Used https://reviews.facebook.net/D603 patch on Apache Hive repository, called
`arc commit` and SVN didn't complain about missing paths.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Maniphest Tasks: T667

Differential Revision: 1189

src/workflow/commit/ArcanistCommitWorkflow.php

index b6413044a8cf1d58528354863bf214ea12d006ec..6957bbcda189c70860b7a2db0aa6e5cdf4c6967d 100644 (file)
@@ -230,12 +230,23 @@ EOTEXT
       array(
         'revision_id' => $revision_id,
       ));
+    $dir_paths = array();
+    foreach ($commit_paths as $path) {
+      $path = dirname($path);
+      while ($path != '.') {
+        $dir_paths[$path] = true;
+        $path = dirname($path);
+      }
+    }
     $commit_paths = array_fill_keys($commit_paths, true);
 
     $status = $repository_api->getSVNStatus();
 
     $modified_but_not_included = array();
     foreach ($status as $path => $mask) {
+      if (!empty($dir_paths[$path])) {
+        $commit_paths[$path] = true;
+      }
       if (!empty($commit_paths[$path])) {
         continue;
       }