Re: [PATCH] Resurrect diff-tree-helper -R
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:41:57
quoted
quoted
quoted
quoted
"PB" == Petr Baudis [off-list ref] writes:
PB> that is, using a '@.' prefix for those. It seems to be unique enough and
PB> '@' is one of the four magic characters prefixing diff lines. Just using
PB> the plain string seems too volatile, and I need to grep all the
PB> interesting bits out of the diff file. This is because patch can
PB> otherwise complain "only garbage found in the patch" when processing the
PB> diff, which confuses my users greatly.
PB> What do you think?
Personally what I think is that grepping in the diff, especially
if the diff is something you are generating (I am assuming that
you are taling about cg-diff fed to cg-patch to port work tree
changes forward), is a wrong way to do things.
The way JIT does the equivalent is via git-apply-patch-script.
You run git-diff-{files,cache,tree}, setting GIT_EXTERNAL_DIFF
environment variable to git-apply-patch-script, and have the
apply-patch-script to take care of the mode changes, creation,
etc. See the implementation of the jit-patch command if you are
interested.