Showing heading of the section following the hunk range in internal diff viewer


Is the custom action required to achieve this output in the internal diff viewer?

Can't quite get the internal diff viewer to show the (optional) heading of the section that shows function that the hunk is part of, following the hunk range.

Is this showing of the function that the hunk is part of, even possible with current version of Sourcetree, ?

Thanks much.

4 answers

Bump. Help... :(

Hi George,

Could you re-phrase your original question. I'm not understanding what you're getting at.


Hello, in the SourceTree in Log/History view, right side is a diff pane.

In a given diff output, one sees the following as an example:

Hunk 1 : Lines 3-15 (previously 3-14)
... dif output

That's good and all, but how do i show the diff heading that looks like following with the heading of the diff section that shows the function that the diff is part of ?

index b1d597c..1097bf4 100644
--- a/src/foo.c
+++ b/src/foo.c
@@ -1809,6 +1809,7 @@ blah42_routine(char** argv,
... dif output

Bump. Did the above info help to clarify the original question? Thanks.

It did for me, I've never noticed that feature of git diff before, but it's pretty awesome.

Unfortunately, I don't think any existing options (including custom actions) are going to achieve what you want. File a feature request on, then post a link here so I (and anyone else who is interested) can vote for it.

Hey George. We parse out the diff in order to generate the diff view. We don't expose any of these options, you'd have to do a Git call to get them :)

It sounds like George wants SourceTree to parse the code being displayed in the diff so that method signatures would be included in the context. For example, a hunk would look like:

function MyFunction() {
//precontext line 3
//precontext line 2
//precontext line 1
diffed lines
//postcontext line 1
//postcontext line 2
//postcontext line 3

I expect most people would understand that the proposed feature is far too complex to implement reliably, especially in languages that allow nested functions. However, if you were able to implement this for even some languages, it would be incredibly helpful/cool.

Yes, showing the method signature like it's shown in the "git diff" output.

Okay, so perhaps SourceTree isn't just using git diff under the hood.

Suggest an answer

Log in or Sign up to answer
Community showcase

Scrum Roles Explained: the Do's and the Don'ts

Hello Community,  Today we are going to talk about the three Scrum Roles. There is the Development Team, the Scrum Master and the Product Owner. In my opinion these three are all really impo...

69 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you