diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-04-29 08:16:10 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-04-29 09:07:04 +0300 |
commit | eed62b29f55e02ea84a4b470651d5c7247633d20 (patch) | |
tree | 85c33bdcad0e7f65cd2fedc8a8677368ed564186 /subplot | |
parent | fdf77e57306f83672253f15e78ceaaadebfb0dec (diff) | |
download | jt2-eed62b29f55e02ea84a4b470651d5c7247633d20.tar.gz |
feat: make a journal a git repository and commit new entries
Diffstat (limited to 'subplot')
-rw-r--r-- | subplot/jt.py | 13 | ||||
-rw-r--r-- | subplot/jt.yaml | 3 |
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 |