From 80a14e1ee72401d4dd3973ca519147666e0e57a7 Mon Sep 17 00:00:00 2001 From: Zach Holman Date: Sun, 28 Feb 2016 23:38:51 -0800 Subject: [PATCH] Output relative paths instead of filenames (fixes #10) --- spaceman-diff | 4 ++-- spaceman-diff-test.sh | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spaceman-diff b/spaceman-diff index eb3bce1..a23697b 100755 --- a/spaceman-diff +++ b/spaceman-diff @@ -52,8 +52,8 @@ else sizeB=0 fi -headerA="OLD: $(basename "$1") ($sizeA KB)" -headerB="NEW: $(basename "$5") ($sizeB KB)" +headerA="OLD: $1 ($sizeA KB)" +headerB="NEW: $5 ($sizeB KB)" lengthA=$(echo $headerA | wc -m | xargs) lengthB=$(echo $headerB | wc -m | xargs) diff --git a/spaceman-diff-test.sh b/spaceman-diff-test.sh index 1faf1a8..71e8ec1 100644 --- a/spaceman-diff-test.sh +++ b/spaceman-diff-test.sh @@ -20,8 +20,8 @@ it_renders_diff() { test/images/flag.png a190ba 100644 \ test/images/gooder-flag.png 000000 100644) - grep -F "OLD: flag.png (84 KB)" < "$output_file" - grep -F "NEW: gooder-flag.png (9 KB)" < "$output_file" + grep -F "OLD: test/images/flag.png (84 KB)" < "$output_file" + grep -F "NEW: test/images/gooder-flag.png (9 KB)" < "$output_file" rm "$output_file" } @@ -32,8 +32,8 @@ it_works_with_output_filenames_containing_spaces() { "test/images/flag.png" a190ba 100644 \ "test/images/with spaces.png" 000000 100644) - grep -F 'OLD: flag.png (84 KB)' < "$output_file" - grep -F 'NEW: with spaces.png (9 KB)' < "$output_file" + grep -F 'OLD: test/images/flag.png (84 KB)' < "$output_file" + grep -F 'NEW: test/images/with spaces.png (9 KB)' < "$output_file" rm "$output_file" } @@ -44,8 +44,8 @@ it_works_with_input_filenames_containing_spaces() { "test/images/with spaces.png" a190ba 100644 \ "test/images/flag.png" 000000 100644) - grep -F 'OLD: with spaces.png (9 KB)' < "$output_file" - grep -F 'NEW: flag.png (84 KB)' < "$output_file" + grep -F 'OLD: test/images/with spaces.png (9 KB)' < "$output_file" + grep -F 'NEW: test/images/flag.png (84 KB)' < "$output_file" rm "$output_file" } @@ -56,8 +56,8 @@ it_works_with_small_files() { "test/images/gooder-flag.png" a190ba 100644 \ "test/images/small-image.png" 000000 100644) - grep -F 'OLD: gooder-flag.png (9 KB)' < "$output_file" - grep -F 'NEW: small-image.png (0 KB)' < "$output_file" + grep -F 'OLD: test/images/gooder-flag.png (9 KB)' < "$output_file" + grep -F 'NEW: test/images/small-image.png (0 KB)' < "$output_file" rm "$output_file" }