From 3a8309c76846ae680c7ef6fd38a26b6ca4ec4130 Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Fri, 2 Aug 2024 19:26:33 +0300 Subject: Add validator to check if prev_commit and current commit match * this is to prevent merge conflict --- web/view/markdown.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'web/view') diff --git a/web/view/markdown.scm b/web/view/markdown.scm index 900378e..8632b8b 100644 --- a/web/view/markdown.scm +++ b/web/view/markdown.scm @@ -91,7 +91,15 @@ commit-sha)) -(define (commit-file repo file-path content commit-message username email) + + + +(define* (commit-file repo file-path content commit-message username email #:optional (prev-commit "")) + (if (string=? prev-commit (get-latest-commit-sha1 repo)) + #t + (throw 'system-error (format #f "Commits do no match.Please pull in latest changes for current * ~a * and prev * ~a * " + (get-latest-commit-sha1 repo) prev-commit)) + ) (if (is-repo? repo) (match (file-exists? (string-append repo "/" file-path)) (#t -- cgit v1.2.3