Bug 1475649 - Always use --untracked-files; r=ahal
authorGregory Szorc <gps@mozilla.com>
Mon, 16 Jul 2018 13:19:09 +0000
changeset 426730 633b1aae6b2ebb4af909cfa85cd51a02c66242dd
parent 426729 f52422f008ed88d270b9af0ba0379e07a7c2268c
child 426731 b37a0606d6a0fa4c397e9779c96f8ed879136a15
push id66402
push userahalberstadt@mozilla.com
push dateMon, 16 Jul 2018 13:19:55 +0000
treeherderautoland@633b1aae6b2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1475649
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1475649 - Always use --untracked-files; r=ahal a35b188d0e44 inadvertently regressed behavior in the case where the Git status.showUntrackedFiles config option was set and we want to purge untracked files. Differential Revision: https://phabricator.services.mozilla.com/D2141
python/mozversioncontrol/mozversioncontrol/__init__.py
--- a/python/mozversioncontrol/mozversioncontrol/__init__.py
+++ b/python/mozversioncontrol/mozversioncontrol/__init__.py
@@ -425,18 +425,25 @@ class GitRepository(Repository):
     def forget_add_remove_files(self, path):
         self._run('reset', path)
 
     def get_files_in_working_directory(self):
         return self._run('ls-files', '-z').split(b'\0')
 
     def working_directory_clean(self, untracked=False, ignored=False):
         args = ['status', '--porcelain']
-        if not untracked:
+
+        # Even in --porcelain mode, behavior is affected by the
+        # ``status.showUntrackedFiles`` option, which means we need to be
+        # explicit about how to treat untracked files.
+        if untracked:
+            args.append('--untracked-files=all')
+        else:
             args.append('--untracked-files=no')
+
         if ignored:
             args.append('--ignored')
 
         return not len(self._run(*args).strip())
 
     def push_to_try(self, message):
         if not self.has_git_cinnabar:
             raise MissingVCSExtension('cinnabar')