Quick poll: diff format for Create Patch

Hello everyone,

I'm currently working on the Create Patch feature (finally, after all those
years... :) ), and I'd like to ask whether we need to support any additional
diff formats besides unified diff. Do I understand correctly that unified
diff will be processed correctly by all tools that consume patches, or are
context and/or simple diff also necessary in some cases?

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


3 comments

Given our current tool-chain we just need to be able to work with Idea
and the Linux tool "patch". From the man page:
"With context diffs, and to a lesser extent with normal diffs, patch can
detect when the line numbers mentioned in the patch are incorrect, and
attempts to find the correct place to apply each hunk of the patch."

So I guess you could get away with only unified diffs and blame the
patch tool when it messes up, or you could produce contextual diffs and
give patch more help ...
My 1c,
R

0

Hello Robert,

RG> Given our current tool-chain we just need to be able to work with Idea
RG> and the Linux tool "patch". From the man page:
RG> "With context diffs, and to a lesser extent with normal diffs, patch can
RG> detect when the line numbers mentioned in the patch are incorrect, and
RG> attempts to find the correct place to apply each hunk of the patch."
RG> So I guess you could get away with only unified diffs and blame the
RG> patch tool when it messes up, or you could produce contextual diffs
RG> and give patch more help ...

But isn't the unified diff simply a more compact re-packaging of the context
diff? I guess it should be equivalent for the 'patch' tool...

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Dmitry Jemerov wrote:

But isn't the unified diff simply a more compact re-packaging of the
context diff? I guess it should be equivalent for the 'patch' tool...

Yes, I think you're right, I did't read all of the man page
"-u or --unified
Interpret the patch file as a unified context diff."
I was thrown off by the fact that it has separate options of -c and -u.
But that's why my poll answer was half price ;)
R

0

Please sign in to leave a comment.