Browse code
Update porcelain to add branches commit-parents and in-repository
Ed Langley authored on 06/05/2019 05:56:00
Showing 2 changed files
Showing 2 changed files
... | ... |
@@ -5,10 +5,29 @@ |
5 | 5 |
(defvar *git-encoding* :utf-8 |
6 | 6 |
"The encoding to use when parsing git objects") |
7 | 7 |
|
8 |
-(defun git-show (object) |
|
9 |
- (elt (sp-ob |
|
10 |
- (babel:octets-to-string |
|
11 |
- (extract-object (repository *git-repository*) |
|
12 |
- object) |
|
13 |
- :encoding *git-encoding*)) |
|
14 |
- 1)) |
|
8 |
+(defun git:in-repository (root) |
|
9 |
+ (setf *git-repository* |
|
10 |
+ (truename root))) |
|
11 |
+ |
|
12 |
+(defun git:show (object) |
|
13 |
+ (babel:octets-to-string |
|
14 |
+ (extract-object (repository *git-repository*) |
|
15 |
+ object) |
|
16 |
+ :encoding *git-encoding*)) |
|
17 |
+ |
|
18 |
+(defun git:branch (&optional (branch "master")) |
|
19 |
+ (let ((branches (branches (repository *git-repository*)))) |
|
20 |
+ (nth-value 0 (serapeum:assocadr branch branches |
|
21 |
+ :test 'equal)))) |
|
22 |
+ |
|
23 |
+(defun git:branches () |
|
24 |
+ (branches (repository *git-repository*))) |
|
25 |
+ |
|
26 |
+(defun git:commit-parents (commit) |
|
27 |
+ (map 'list #'cadr |
|
28 |
+ (remove-if-not (serapeum:op |
|
29 |
+ (string= "parent" _)) |
|
30 |
+ (nth-value 1 |
|
31 |
+ (fwoar.cl-git::parse-commit |
|
32 |
+ (git:show commit))) |
|
33 |
+ :key #'car))) |