diff options
Diffstat (limited to 'guix.scm')
| -rw-r--r-- | guix.scm | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/guix.scm b/guix.scm index a281fee..0a0885b 100644 --- a/guix.scm +++ b/guix.scm @@ -351,7 +351,34 @@ to link the system SQLite3 instead of a bundled copy.") (invoke "sh" "-c" (string-append "./bin/ai-memory -C tmp/cpp --db" " tmp/cpp/store.sqlite why inc" - " | grep -q 'fn kern.cpp.inc, context'"))))) + " | grep -q 'fn kern.cpp.inc, context'")) + ;; Python and Ruby are line-scanned, which is also the only + ;; thing that can attribute a file that was just *added*: git + ;; has no before-side for it, so its hunks carry no context. + (call-with-output-file "tmp/cpp/script.py" + (lambda (out) + (display "import os\n\ndef helper(x):\n return x\n" out))) + (call-with-output-file "tmp/cpp/script.rb" + (lambda (out) + (display "module Util\n def self.twice(x)\n x * 2\n end\nend\n" out))) + (invoke "git" "-C" "tmp/cpp" "add" "script.py" "script.rb") + (invoke "git" "-C" "tmp/cpp" "-c" "user.name=check" + "-c" "user.email=check@example" "commit" "-qm" "add scripts") + (invoke "./bin/ai-memory" "-C" "tmp/cpp" "--db" + "tmp/cpp/store.sqlite" "sync") + (invoke "sh" "-c" + (string-append "./bin/ai-memory -C tmp/cpp --db" + " tmp/cpp/store.sqlite why helper" + " | grep -q 'fn script.helper, add'")) + (invoke "sh" "-c" + (string-append "./bin/ai-memory -C tmp/cpp --db" + " tmp/cpp/store.sqlite why twice" + " | grep -q 'fn script.twice, add'")) + ;; The substring lookup: `why script' reaches both files. + (invoke "sh" "-c" + (string-append "./bin/ai-memory -C tmp/cpp --db" + " tmp/cpp/store.sqlite why script" + " | grep -q 'fn script.helper, add'"))))) (replace 'install (lambda _ (install-file "bin/ai-memory" |
