summaryrefslogtreecommitdiff
path: root/subplot
diff options
context:
space:
mode:
Diffstat (limited to 'subplot')
-rw-r--r--subplot/jt.py13
-rw-r--r--subplot/jt.yaml3
2 files changed, 16 insertions, 0 deletions
diff --git a/subplot/jt.py b/subplot/jt.py
index d6023b3..0117736 100644
--- a/subplot/jt.py
+++ b/subplot/jt.py
@@ -166,3 +166,16 @@ def file_name_has_suffix(ctx, varname=None, suffix=None):
variables = ctx.get("variables", {})
filename = variables[varname]
assert filename.endswith(suffix)
+
+
+def git_is_clean(ctx, dirname=None):
+ runcmd_run = globals()["runcmd_run"]
+ runcmd_exit_code_is_zero = globals()["runcmd_exit_code_is_zero"]
+ runcmd_get_stdout = globals()["runcmd_get_stdout"]
+ assert_eq = globals()["assert_eq"]
+
+ runcmd_run(ctx, ["git", "status", "--porcelain"], cwd=dirname)
+ runcmd_exit_code_is_zero(ctx)
+
+ stdout = runcmd_get_stdout(ctx)
+ assert_eq(stdout, "")
diff --git a/subplot/jt.yaml b/subplot/jt.yaml
index a3d4f0f..dc2a666 100644
--- a/subplot/jt.yaml
+++ b/subplot/jt.yaml
@@ -60,3 +60,6 @@
- then: file name <{varname}> ends with {suffix}
function: file_name_has_suffix
+
+- then: there are no uncommitted changes in {dirname}
+ function: git_is_clean