Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Why does one file in my project think its completely being changed?

Richard Fyffe May 4, 2015

So I'm using source tree and I'm working on a website, however 1 of my JS files ALWAYS treats the whole file as a single hunk. Hunk 1: Lines 0-0 It shows the first line as removed, then the whole file in white then the first line in green and the whole file in white. So its impossible to review what changes I made, discard or change individual hunks/lines. No other file is doing this and its only this file. It also appears this way in bitbucket so without doing a side-by-side diff I can't see what changes were done. Why is this happening? What steps should I take to resolve this?

2 answers

0 votes
jonbhanson October 26, 2017

I had the same problem, Hunk 1: lines 0-0 and it would not show updates in the file.  I was able to solve the problem by copying the code, deleting the (php) file in question, creating it again fresh, and pasting the code back in. YMMV.

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 4, 2015

I would suspect white-space changes, possibly line-endings. Is SourceTree configured to show whitespace changes in the diff panel?

Richard Fyffe May 4, 2015

Yes, if I add a few empty lines to a normal files it'll show as new empty lines in source tree.

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 4, 2015

By "line-endings", I don't mean extra newlines, I mean the different byte sequences that can be used to signify a new line based on the source OS. http://en.wikipedia.org/wiki/Newline

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 4, 2015

If you switch sourcetree to ignore whitespace, you should be able to get a useable diff.

Richard Fyffe May 5, 2015

So I actually checked the settings and it's already set to ignore white space, I was testing with new lines.

thinsoldier
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 2015

FYI SourceTree's diff panel doesn't seem to have a clue about displaying files that use Classic Mac line endings.

thinsoldier
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 2015

FYI if you set a file to be executable it will show as changed but without showing any lines have actually changed.

Richard Fyffe May 5, 2015

If its the line endings why is only one file effected? How do I change this file to a crlf endings? If its executable how to a revert that?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events