Thread (13 messages) flat view 13 messages, 3 authors, 2016-06-15

Re: [PATCH 1/2] Allow git-apply to fix up the line counts

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:44:41

Hi,

On Thu, 5 Jun 2008, Johannes Sixt wrote:
Johannes Schindelin schrieb:
quoted
On Thu, 5 Jun 2008, Johannes Sixt wrote:
quoted
Johannes Schindelin schrieb:
quoted
+--fixup-line-counts::
+	Fix up the line counts (e.g. after editing the patch without
+	adjusting the hunk headers appropriately).
This sort of implies that there is some kind of output that tells the 
correct line counts. But that isn't the case (if I read the patch 
correctly). So I suggest to name the option --ignore-line-counts.
But there is some kind of output: the hunks themselves.
Is there?
Yes!
I did this (it rewrites all line counts to 1):

$ git diff ..HEAD~1 |
	sed -e '/^@@/s/,[0-9]+ /,1 /g' |
	./git-apply --fixup-line-counts

and there was no output. Instead, the patch was applied.
As I said, the data is in the _hunks_, but I maybe should have added _not 
in the hunk headers_.

So in a very real sense, you edit the hunks, and the hunk headers are 
adjusted to that.  You did not adjust the hunks, so they got applied.

It seems that you think the hunk header's line counts are heeded, and the 
hunk adjusted, with --fixup-line-counts?  Sorry, I find that rather 
counterintuitive.
quoted
 And the line counts are not ignored, but they are actively rewritten.
Of course, internally there is some sort of "output" from the fixup 
routine, and the line counts are rewritten and then are not ignored. But 
the user doesn't care about this internal procedure. From the user's 
perspective, the line counts of the input patch are ignored.
But they are not!

There are _two_ things that are the line counts.  Those numbers in the 
hunk header, and the real line counts of the hunks.

Now, if you say they are _ignored_, would that not imply in plain English 
that they are left unchanged (in limbo, because those two types of numbers 
contradict each other)?

Okay, how about shikebedding this to --adjust-line-counts?

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help