Skip to content

Commit cd664a3

Browse files
committed
handled bs hash for uncommitted lines in server
git blame returns 00000000 as the treeish for uncommitted lines ( and lines with uncommitted changes).
1 parent f5b83f7 commit cd664a3

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ csc -static -unit listicles -cJ listicles.scm
3535

3636
echo "Building private_comments executable..."
3737

38-
csc -link masufiles \
38+
csc -link masutils \
39+
-link masufiles \
3940
-link pathname-expand \
4041
-static private_comments.scm
4142

src/private_comments.scm

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
(import spiffy-request-vars)
3434
(import uri-common)
3535
(import shell)
36+
(import masutils)
3637
(import masufiles)
3738

3839
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -226,11 +227,16 @@
226227
;
227228
(define (handle-comment add-or-delete params)
228229
;TODO Update headers to specify
229-
(if (has-required-keys? params)
230-
(let ((project-hash (cdr (assoc 'project_name_hash params)))
231-
(file-path-hash (cdr (assoc 'file_path_hash params)))
232-
(line-no (cdr (assoc 'line_number params)))
233-
(treeish (cdr (assoc 'treeish params))))
230+
(if (and
231+
(has-required-keys? params)
232+
(not (or
233+
(== (alist-ref 'treeish params) "00000000")
234+
(null? (alist-ref 'treeish params)))))
235+
236+
(let ((project-hash (alist-ref 'project_name_hash params))
237+
(file-path-hash (alist-ref 'file_path_hash params))
238+
(line-no (alist-ref 'line_number params))
239+
(treeish (alist-ref 'treeish params)))
234240
(let* (
235241
(project-dir (list->path (list base-directory project-hash)))
236242
(treeish-dir (list->path (list base-directory project-hash treeish)))

0 commit comments

Comments
 (0)