Merge "google-java-format: remove sorting import argument" into main
diff --git a/README.md b/README.md
index 7befb53..9b855ec 100644
--- a/README.md
+++ b/README.md
@@ -114,6 +114,9 @@
are automatically expanded for you:
* `${REPO_PATH}`: The path to the project relative to the root.
+ e.g. `tools/repohooks`
+* `${REPO_PROJECT}`: The name of the project.
+ e.g. `platform/tools/repohooks`
* `${REPO_ROOT}`: The absolute path of the root of the repo checkout. If the
project is in a submanifest, this points to the root of the submanifest.
* `${REPO_OUTER_ROOT}`: The absolute path of the root of the repo checkout.
diff --git a/rh/hooks.py b/rh/hooks.py
index 7f62713..453f74e 100644
--- a/rh/hooks.py
+++ b/rh/hooks.py
@@ -134,6 +134,11 @@
return os.environ.get('REPO_PATH', '')
@property
+ def var_REPO_PROJECT(self):
+ """The name of the project"""
+ return os.environ.get('REPO_PROJECT', '')
+
+ @property
def var_REPO_ROOT(self):
"""The root of the repo (sub-manifest) checkout."""
return rh.git.find_repo_root()
diff --git a/rh/hooks_unittest.py b/rh/hooks_unittest.py
index 0bb7726..389fe07 100755
--- a/rh/hooks_unittest.py
+++ b/rh/hooks_unittest.py
@@ -197,6 +197,13 @@
os.environ['REPO_PATH'] = 'foo/bar'
self.assertEqual(self.replacer.get('REPO_PATH'), 'foo/bar')
+ def testREPO_PROJECT(self):
+ """Verify handling of REPO_PROJECT."""
+ os.environ['REPO_PROJECT'] = ''
+ self.assertEqual(self.replacer.get('REPO_PROJECT'), '')
+ os.environ['REPO_PROJECT'] = 'platform/foo/bar'
+ self.assertEqual(self.replacer.get('REPO_PROJECT'), 'platform/foo/bar')
+
@mock.patch.object(rh.hooks, '_get_build_os_name', return_value='vapier os')
def testBUILD_OS(self, m):
"""Verify handling of BUILD_OS."""