Skip to content

7. Commit messages ​

area prints the midpoint rule's result too:

console
$ git diff --cached
diff --git a/src/area.F90 b/src/area.F90
index c5a6c73..f8cd4ac 100644
--- a/src/area.F90
+++ b/src/area.F90
@@ -1,7 +1,7 @@
 !< The integral of sin(x) over [0, pi], exact value 2, with n intervals (the first argument, default 16).
 program area
 !< The integral of sin(x) over [0, pi], exact value 2, with n intervals (the first argument, default 16).
-use quad_rules, only : R8P, trapezoid, simpson
+use quad_rules, only : R8P, midpoint, trapezoid, simpson
 use integrands, only : sine
 implicit none
 real(R8P), parameter :: pi = acos(-1._R8P) !< Pi.
@@ -16,4 +16,5 @@ endif
 print '(A, I0)', 'n = ', n
 print '(A, ES24.17)', 'trapezoid = ', trapezoid(sine, 0._R8P, pi, n)
 print '(A, ES24.17)', 'simpson = ', simpson(sine, 0._R8P, pi, n)
+print '(A, ES24.17)', 'midpoint = ', midpoint(sine, 0._R8P, pi, n)
 endprogram area

Before any model, fobis commit --show-facts prints what FoBiS knows about the staged change: the scopes the history of these files suggests, which lines are code, comments or directives, which procedures changed, whether an interface changed:

console
$ fobis commit --show-facts
## Facts of the change (computed by FoBiS from git and the sources)

Scope candidates (use one of these, or an empty scope for a cross-cutting change):
- area: src/area.F90 is new to the history: named after its directory

Fortran sources (changed lines classified by the lexer; comment = comment or blank):
- src/area.F90: changed lines (removed + added): 3 code; procedures: area

The model writes the message from the diff and these facts, in the Conventional Commits form, and the scope is restricted to the candidates:

console
$ fobis commit
[managed:coder-7b] Generating commit message…
Using the running llama-server at http://127.0.0.1:41675

refactor(area): add midpoint integration method

Add the midpoint integration method to the area program. This method provides an
additional way to compute the integral of sin(x) over [0, pi].

The scope is right and the description reads well, but the type is wrong: a program that prints a new result is a feat, not a refactor. That is why fobis commit prints the message and commits nothing; --apply asks before running git commit.

fobis llm doctor and fobis commit with a local model

What you learned

fobis commit, --show-facts, --apply. Reference: commit messages.

Next: 8. Merge conflicts.