From 6ab7d2cee7f0bff6463f3e2fb3958a7ba2eb21d2 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Wed, 23 May 2018 09:24:52 +0200 Subject: [PATCH] boot: Bugfix for diff on mes. * scripts/diff.scm (diff-files): Rename from diff; Avoids name clash with module to allow using -e '()' hack. --- scripts/diff.scm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/diff.scm b/scripts/diff.scm index d8ade78f..74eef112 100755 --- a/scripts/diff.scm +++ b/scripts/diff.scm @@ -73,8 +73,7 @@ exec ${MES-mes} -L $(dirname 0) -e '(diff)' -s "$0" "$@" (define (line-equal? a b) (equal? (string-trim-right a) (string-trim-right b))) -;; naive diff -(define (diff a b) +(define (diff-files a b) (let ((a-lines (string-split (with-input-from-file a read-string) #\newline)) (b-lines (string-split (with-input-from-file b read-string) #\newline))) (let loop ((context '(1 1 #f #f #f)) (a-lines a-lines) (b-lines b-lines)) @@ -116,7 +115,7 @@ exec ${MES-mes} -L $(dirname 0) -e '(diff)' -s "$0" "$@" (define (main args) (let* ((files (cdr args)) (files (if (string-prefix? "-" (car files)) (cdr files) files)) - (hunks (apply diff (list-head files 2)))) + (hunks (apply diff-files (list-head files 2)))) (when (pair? hunks) (display (string-join (append-map hunk->lines hunks) "\n")) (newline)