-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should we change how hunk headers look? #100
Comments
Yeah! More readability can be added there for sure. As I decompile it, it is the line number where the diff starts (including context lines), and the amount of lines. For myself, I'm mostly looking for the line start, but then also of the first changed line, so I can enter it in my editor and go there, exactly there. This is (as I understand), the third number + context lines. Something alike But I guess other people use the presented data for other purposes? |
I reworked my script to capture the @@ lines and display them differently, I'm just not sure what "differently" looks like right now. I started off with just: "* Line #3 *" as that's raw from the diff. I use it the same way you do, "where do I go after I open up the this file". Maybe it should be the line number + the context lines (i.e. go directly to the first changed line)? |
This is an example of what I've come up with so far:
|
Looks great! (in the screenshot) Wouldn't it be nice to add a newline in between blocks in the same file? Further I think we could do without the "Changes start on line". After you've started using it, that will quickly become obsolete and just extra clutter. |
nice! yeah let's make this easier. the official docs on the hunk header: https://github.com/git/git/blob/master/Documentation/diff-generate-patch.txt#L154-L185 it always starts with Things we could say:
… proposal in next comment … |
My ideal might be the following:
bigger and details:
|
The problem I'm running in to is commits where the ONLY change is a perm change. Here the first commit is ONLY a perm change and then continues on with a regular addition:
Currently we remove the I can remove that sed call, but that then breaks the whitespace line @paulirish wanted after each commit. Other than that little thing I think I have it all working. I even wrote tests! |
K.
Let's move that piece into the Perl.
It seems like it's still possible to handle the line spacing but I can look
once your patch of up
|
You really think putting the file name twice is necessary? It seems a little redundant and "noisy" to me. I was thinking something like:
|
There may not always be two See: https://github.com/git/git/blob/master/Documentation/diff-generate-patch.txt#L91 |
I don't know if we're going to be able to (easily) calculate lines changed. Take for example this diff:
The In another example I removed 8 lines, and added 8 totally unrelated lines and the diff still showed |
You can copy-paste the
That's why GitHub only shows (and communicates in their API) the amount of additions and removals, and the amount of commits in a PR, but not the amount of changed lines. |
Lines added/removed really only makes sense in the context of a whole file or a whole pull request. I'm a fan of not including that on a per-hunk basis. |
okey doke. Let's leave that out of scope for now. so I guess we end up with either
or
I have a preference for the former (assuming |
👍 |
Everything is trivial in Perl :) |
\o/ |
Raw diffs include the lines numbers encoded strangely:
Note the magenta line numbers surrounded by @@. Should we:
The text was updated successfully, but these errors were encountered: