Skip to content

Commit

Permalink
Merge pull request #11 from holman/relative-paths
Browse files Browse the repository at this point in the history
Output relative paths instead of filenames
  • Loading branch information
holman committed Feb 29, 2016
2 parents 6d6c9e3 + 80a14e1 commit 70a41ef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions spaceman-diff
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions spaceman-diff-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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"
}
Expand All @@ -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"
}
Expand All @@ -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"
}

0 comments on commit 70a41ef

Please sign in to comment.