commit changes from run (and duct logs) and include duct summary in the commit message
- Dominant language
- Python
- Stars
- 12
- Forks
- 6
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 2
Description
Here is a brief example of commit-msg hook in action
```shell
❯ echo -e '#!/bin/sh\necho -n "\\n\\nduct report: { \\"hostname\": \\"`hostname`\\", \\"wallclock_time\\": 123 }" >> "$1"' >| .git/hooks/commit-msg; chmod a+x .git/hooks/commit-msg
❯ rm -f 123; echo 123 > 123; git add 123; git commit -m "Added 123"; git show
[master 6637263] Added 123
1 file changed, 1 insertion(+)
create mode 100644 123
commit 66372631d05c71112b74bd6a7223ddc4674c20d4 (HEAD -> master)
Author: Yaroslav Halchenko
Date: Mon Aug 12 16:12:41 2024 -0400
Added 123
duct report: { "hostname": "bilena", "wallclock_time": 123 }
diff --git a/123 b/123
new file mode 100644
index 0000000..190a180
--- /dev/null
+++ b/123
@@ -0,0 +1 @@
+123
```
To utilize on this I think we need
- git commit-msg hook which would
- see if there is there are *relevant* `duct` run record(s)
- "render" brief report to include in commit message which would include basics like
- hostname
- peak memory
- wall clock time
- but in general should be configurable (`format` string) probably
- add to the commit message file
- `con-duct install` to install that `commit-msg` hook into a repository of interest
- figure out machinery to figure out `relevant` record(s)
- actually it is quite simple -- it is those which are to be committed (staged or may be not even added yet)!
- Typically with `datalad run duct ...` invocation we are kinda guaranteed to have just 1 `duct` record.
- TODO: check if would or not be in place for git-annex'es commits within git-annex branch (@yarikoptic forgot what was the decision there on git-annex side).
Use case which inspired:
- for https://github.com/ReproNim/reproflow-data-sync I was not sure on which box I ran that data fetching script. I reuse the same `user.email` so I am "the same" across all boxes.
- with #31 - it is a frequent desire to know what versions of software were used to run a particular command
Contributor guide
Research direction
Start with the commit-msg hook example and the proposed con-duct install entry point. Define how relevant duct records are identified for staged or unstaged files, how configurable hostname, memory, and wall-clock fields are rendered, and whether git-annex commits need special handling. Done means the hook can add a duct summary to the commit message and installation works for a repository.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, python
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100