Commit 95b5977
Speed up hook diff processing (#27)
* test
* Add profiling feature with macro for measuring execution time
* Refactor diff processing, optimize token handling and storage
* Update test signatures and add profiling tests
* Refactor GitFile signatures and commit messages
Optimize PatchDiff with parallel processing
Add rayon dependency to Cargo.toml
Remove redundant patch tests
Update Cargo.lock with new dependencies
Remove profiling tests
* Update Cargo.lock dependencies and checksums
* Update dependencies in Cargo.toml and Cargo.lock
* Add StringPool for efficient memory use in PatchDiff
* Update dependencies in Cargo.toml and Cargo.lock
* Add `num_cpus` crate and parallelize file processing
* Refactor file processing to use parallel chunks and atomic tokens
* Remove redundant import of `bail` from anyhow
* Sort files by token count in `PatchDiff` implementation.
* Delete test.txt file
* Improve error handling and path management in config and style modules
* Add tests for StringPool functionality in hook.rs
* Update default model and add profiling to model and commit functions
* Add profiling to filesystem module functions
* Implement token counting and generation for commit messages
* Add documentation for Filesystem, File, and Dir structs in filesystem.rs
* Refactor commit message generation methods and file handling logic
* Implement configuration file management and update functions in App
* Implement parallel processing of diff data in PatchDiff trait
* ```
feat: Add Finetune functionality and related files
- Introduce finetune.rs to manage fine-tuning workflows with OpenAI.
- Create finetune.md for documenting the finetuning process.
- Update Cargo.toml and Cargo.lock with necessary dependencies for finetuning.
- Add stats.json to track various parameters in the finetuning process.
```
* ```
Add instruction template constant to commit.rs
- Introduce `INSTRUCTION_TEMPLATE` constant for prompt file content.
```
* Remove unused import of `std::fs` from `commit.rs` file.
* Remove unused import and adjust available tokens calculation
- Remove the import of `Model` and update the `available_tokens` calculations in the `call` function.
* Update max commit length in prompt guidelines
- Change maximum commit length from 72 to {{max_commit_length}} characters.
* ```
Modify imports and refactor filesystem profiling
Based only on the changes visible in the diff, this commit:
- Removes unnecessary profiling statements and imports in `filesystem.rs`.
- Adds an import for `App` from `config` in `main.rs`.
```
* Add directory creation for hooks if it does not exist
- Implement logic to check for the existence of the hooks directory and create it if it's missing.
* Add dead code allowance in filesystem.rs
Based only on the changes visible in the diff, this commit adds a line to allow dead code in the `filesystem.rs` file.
* Revert "```"
This reverts commit 7b9aa2f.
* ```
Update Command enum definition
Based only on the changes visible in the diff, this commit modifies
the existing Command enum without altering its structure or commands.
```
* Delete stats.json file
Based only on the changes visible in the diff, this commit removes the stats.json file.
* ```
Remove install, reinstall, and uninstall modules
Based only on the changes visible in the diff, this commit deletes
the files src/install.rs, src/reinstall.rs, and src/uninstall.rs.
```
* Build inline
* Update default model name in Args implementation
Based only on the changes visible in the diff, this commit modifies the default model name in the Args implementation from "gpt-4o" to "gpt-4o-mini".
* ```
Create hook stress test script
Based only on the changes visible in the diff, this commit adds
a new script for testing various operations in a Git hook context.
```
* ```
Add comprehensive tests script
Based only on the changes visible in the diff, this commit adds a new
Fish script `comprehensive-tests` that includes a series of tests
for various Git operations.
```
* Change file permission of comprehensive-tests.
- Update file mode from 644 to 755.
* Update `comprehensive-tests` script to load environment variables from `.env.local`
This commit updates the `comprehensive-tests` script by adding logic to read and load environment variables from a
* Remove note about output being used as a git commit message from 'prompt.md'
* Update comprehensive-tests script and prompt.md documentation
Based only on
* Update scripts and source code according to visible changes in the diff
Based on the changes visible in the diff, this commit updates the comprehensive testing scripts, modifies several source files related to- 'hook.rs','patch_test.rs', and adds new methods and tests.
Here is a summary of specific changes:
- In `comprehensive-tests` script, add `--debug` flag to `cargo install` command
- Adjust logic to check for ample remaining tokens in `hook.rs`
- Modify Diff and PatchRepository implementations for `hook.rs` and `patch_test.rs`.
- Modify test cases in the `patch_test.rs` script.
Please note each individual file has significant changes that add, modify or enhance the functionality as per the needs reflected in the diffs. However, all changes stick to the theme of improving handling of patches, diffs, and commit-related functionalities.
* Refactor `hook.rs` and ensure a minimum of 512 tokens
Based only on the changes visible in the diff, this commit:
- Adds nine lines to check for an empty diff and handle amend operations in `src/bin/hook.rs`
- Removes four lines related to the error message for no changes found to commit
- Modifies a line to ensure a minimum of 512 remaining tokens
- Appends a four-line snippet to handle amend operations when the source is a commit
* Update clean-up command in comprehensive-tests script
Based only on the changes visible in the diff, this commit:
- Replaces the commented clean-up command in comprehensive-tests script with an active one.
* Add attribute to suppress dead code warnings in hook.rs
* Add initial boilerplate for hook.rs
This commit introduces the initial boilerplate for the `hook.rs` file. The added codes allow for dead code, which is often used during the early stages of development. This single-line addition simply contributes to the initial setup of the file.
* Add debug message when a commit message already exists in hook.rs
Based only on the changes visible in the diff, this commit:
- Adds code for checking if a commit message already exists and is not empty in the file hook.rs,
- If the message exists, a debug log message is displayed, and the function returns, clearing the progress bar.
* Add `to_commit_diff` and `configure_commit_diff_options` methods to `PatchRepository` trait
Based only on the changes visible in the diff, this commit:
- Adds the `to_commit_diff` method to the `PatchRepository` trait which returns a `Result<git2::Diff<'_>>`
- Implements `to_commit_diff` in the `PatchRepository` trait for `Repository` class, where it configures diff options and conducts the diff operation based on the provided tree option
- Adds the `configure_commit_diff_options` method to the `PatchRepository` trait which doesn't return anything but changes the state of provided `DiffOptions`
- Implements `configure_commit_diff_options` in the `PatchRepository` trait for `Repository` class, where it sets various options for a diff operation
- Replaces the usage of `to_diff` method with `to_commit_diff` in the `PatchRepository` implementation for `Repository`.
* Optimize max_tokens_per_file calculation in hook.rs
The max_tokens_per_file calculation within the `process_chunk` function of hook.rs now considers the case of zero remaining files. If no files are remaining, the total_remaining value is assigned to max_tokens_per_file directly.
* Refactor method calls and condition checks in openai.rs and patch_test.rs
* Refine instructions and guidelines for generating git commit messages
* Add error handling for raw SHA1 resolution in hook.rs
* Refactor function calls in patch_test.rs and simplify conditional logic in hook.rs
* Refactor reference resolution in hook.rs
---------
Co-authored-by: Git AI Test <[email protected]>1 parent 74b1027 commit 95b5977
File tree
10 files changed
+42
-296
lines changed- src
10 files changed
+42
-296
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
| 80 | + | |
77 | 81 | | |
78 | 82 | | |
79 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
46 | | - | |
| 47 | + | |
47 | 48 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 49 | + | |
56 | 50 | | |
57 | | - | |
| 51 | + | |
58 | 52 | | |
59 | 53 | | |
60 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
282 | | - | |
283 | | - | |
| 282 | + | |
284 | 283 | | |
285 | 284 | | |
286 | 285 | | |
287 | 286 | | |
288 | 287 | | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
300 | 292 | | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
309 | 304 | | |
310 | 305 | | |
311 | 306 | | |
| |||
371 | 366 | | |
372 | 367 | | |
373 | 368 | | |
374 | | - | |
| 369 | + | |
375 | 370 | | |
376 | 371 | | |
377 | 372 | | |
| |||
408 | 403 | | |
409 | 404 | | |
410 | 405 | | |
411 | | - | |
412 | | - | |
413 | 406 | | |
414 | 407 | | |
415 | 408 | | |
| |||
452 | 445 | | |
453 | 446 | | |
454 | 447 | | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | 448 | | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
| 159 | + | |
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
| |||
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
168 | | - | |
| 169 | + | |
169 | 170 | | |
170 | 171 | | |
171 | 172 | | |
172 | | - | |
| 173 | + | |
173 | 174 | | |
174 | 175 | | |
175 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
34 | 33 | | |
35 | 34 | | |
0 commit comments