Cannot stage truncated hunk

dchilvers December 11, 2014

I have a file with a series of changes (11) . All of the the hunk buttons are enabled apart from the last one which is greyed out. Please can you explain why.

 

David Chilvers

4 answers

1 accepted

3 votes
Answer accepted
Jonas Meyer January 1, 2015

On windows, If you go to Tools->Options->Diff, there is a property "Max Diff Line Count",

Increasing cap to suit your needs will make Sourcetree show the entire diff, and ungrey the buttons.

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.
January 1, 2015

Wow, that's handy. Thanks!

dchilvers January 4, 2015

Thanks for that.

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.
December 12, 2014

It may not be unduly large, but it appears to be larger that SourceTree is willing to handle. You can obviously choose to stage the entire file, or try to figure out how to stage hunks via command line. Other than that, I've updated my answer with a possible alternative.

0 votes
dchilvers December 12, 2014

BTW I am using Windows 7, SourceTree 1.6.11.0 and git version 1.9.0.msysgit.0 Seth, I tried your suggestion but to no avail. The last hunk of about 500 lines, a pure insertion, still had the stage hunk button greyed out. 500 lines does not seem unduly large for a hunk. David

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.
December 11, 2014

SourceTree limits how much of a diff it displays. If there are too many changes, SourceTree will eventually truncate the display in the middle of a hunk. It does not let you stage or discard that hunk because it is not showing you the entire hunk.

If you choose to stage or discard earlier hunks, it should reduce your diff content enough to display that entire hunk, which would let you use the buttons.

It's an annoying feature, but I assume it is necessary to keep SourceTree responsive when viewing large changesets.

EDIT: If your hunk is still too large, you can try highlighting large portions of it by clicking and shift-clicking within the large hunk, then staging or discarding "selected lines". I have never tried this in a partially displayed hunk, so I'm not sure if you'll be allowed or not.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events