Skip to content

Commit

Permalink
Hunk sections should use the full path, not basename() (Addresses #280)
Browse files Browse the repository at this point in the history
  • Loading branch information
scottchiefbaker committed Jan 18, 2018
1 parent 068c0ec commit 49969f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion diff-so-fancy
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ sub do_dsf_stuff {
}

my ($orig_offset, $orig_count, $new_offset, $new_count) = parse_hunk_header($hunk_header);
$last_file_seen = basename($last_file_seen);
#$last_file_seen = basename($last_file_seen);

# Figure out the start line
my $start_line = start_line_calc($new_offset,$new_count);
Expand Down
6 changes: 3 additions & 3 deletions test/diff-so-fancy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ output=$( load_fixture "ls-function" | $diff_so_fancy )
output=$( load_fixture "dotfiles" | $diff_so_fancy )
run printf "%s" "$output"

assert_line --index 188 --partial "@ diff-so-fancy:1 @"
assert_line --index 188 --partial "@ bin/diff-so-fancy:1 @"
}

@test "Hunk formatting: @@@ -A,B -C,D +E,F @@@" {
# stderr forced into output
output=$( load_fixture "complex-hunks" | $diff_so_fancy 2>&1 )
run printf "%s" "$output"

assert_line --index 4 --partial "@ header_clean.pl:107 @"
assert_line --index 4 --partial "@ libs/header_clean/header_clean.pl:107 @"
refute_output --partial 'Use of uninitialized value'
}

Expand Down Expand Up @@ -221,5 +221,5 @@ output=$( load_fixture "ls-function" | $diff_so_fancy )
run printf "%s" "$output"

assert_line --index 1 --partial "modified: doc/manual.xml.head"
assert_line --index 3 --partial "@ manual.xml.head:8355 @"
assert_line --index 3 --partial "@ doc/manual.xml.head:8355 @"
}

0 comments on commit 49969f0

Please sign in to comment.