diff: print the file header on GIT_DIFF_FORMAT_PATCH_HEADER #6888
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
diff: print the file header on GIT_DIFF_FORMAT_PATCH_HEADER
In
diff_print_patch_file
we try to avoid printing the file if we're not surethat there will be some content. This works fine if we have any later functions
that might get called as part of printing. But when given the format
GIT_DIFF_FORMAT_PATCH_HEADER
, this is the only function to get called.Add the binary and hunk functions to those to be called when given this option
and have them exit after printing the header. This takes care of printing the
header if we would be issuing a hunk, but we skip that part.
This is an alternative to #6887 which is a bit more wasteful of function calls but it shouldn't regress the issue that was originally intended to fix when introducing this regression by only printing the header if we would have printed a chunk.
I'm not positive that the hunk and binary functions are the two that should get called but I think this should be enough.