git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH 1/2] Allow git-apply to fix up the line counts
Date: Thu, 05 Jun 2008 16:13:51 +0200	[thread overview]
Message-ID: <4847F49F.8090004@viscovery.net> (raw)
In-Reply-To: <alpine.DEB.1.00.0806051441560.21190@racer>

Johannes Schindelin schrieb:
> Hi,
> 
> On Thu, 5 Jun 2008, Johannes Sixt wrote:
> 
>> Johannes Schindelin schrieb:
>>
>>> On Thu, 5 Jun 2008, Johannes Sixt wrote:
>>>
>>>> Johannes Schindelin schrieb:
>>>>> +--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_.

Yes, of course.

> 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.

Yes, of course.

But the example pretends that the hunks have been edited so heavily that
they in no way match the line counts in the hunk headers.

> It seems that you think the hunk header's line counts are heeded, and the 
> hunk adjusted, with --fixup-line-counts?

NO, of course *NOT*.

>  Sorry, I find that rather 
> counterintuitive.

So would I.

>>>  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.

And I was always talking about the numbers in the hunk headers.

> 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)?

That you *internally* rewrite those numbers and then do *not* ignore them
is totally pointless for the user. It's an implementation detail. The user
doesn't see what is going on nor should he care. From the user's
perspective, the hunk header line counts are _ignored_ (because if they
were not ignored, then there would be an error message in the
contradicting case).

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

>From the user's perspective, nothing is "adjusted"; the hunk header line
counts are ... you guess it ... *ignored*.

-- Hannes

  reply	other threads:[~2008-06-05 14:14 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-05 10:16 [PATCH 1/2] Allow git-apply to fix up the line counts Johannes Schindelin
2008-06-05 10:17 ` [PATCH 2/2] git-add: introduce --edit (to edit the diff vs. the index) Johannes Schindelin
2008-06-05 11:24 ` [PATCH 1/2] Allow git-apply to fix up the line counts Johannes Sixt
2008-06-05 13:04   ` Johannes Schindelin
2008-06-05 13:36     ` Johannes Sixt
2008-06-05 13:47       ` Johannes Schindelin
2008-06-05 14:13         ` Johannes Sixt [this message]
2008-06-05 14:54           ` Johannes Schindelin
2008-06-05 15:07             ` Johannes Sixt
2008-06-05 16:19               ` [PATCH v2 0/2] git add --edit Johannes Schindelin
2008-06-05 16:20                 ` [PATCH v2 1/2] Allow git-apply to ignore the hunk headers Johannes Schindelin
2008-06-05 21:16                   ` Junio C Hamano
2008-06-05 22:39                     ` Johannes Schindelin
2008-06-05 23:06                       ` [PATCH v3 0/2] git add --edit Johannes Schindelin
2008-06-05 23:06                         ` [PATCH v3 1/2] Allow git-apply to ignore the hunk headers (AKA recountdiff) Johannes Schindelin
2008-06-06  4:55                           ` Junio C Hamano
2008-06-06 13:58                             ` Johannes Schindelin
2008-06-06 15:34                               ` Junio C Hamano
2008-06-06 16:13                               ` Junio C Hamano
2008-06-06 16:37                                 ` Johannes Schindelin
2008-06-06 16:46                                   ` Junio C Hamano
2008-06-06 17:35                                     ` Johannes Schindelin
2008-06-06  5:18                           ` Govind Salinas
2008-06-06 14:00                             ` Johannes Schindelin
2008-06-05 23:07                         ` [PATCH v3 2/2] git-add: introduce --edit (to edit the diff vs. the index) Johannes Schindelin
2008-06-06 10:02                           ` Olivier Marin
2008-06-06 14:21                             ` Johannes Schindelin
2008-06-06  4:55                         ` [PATCH v3 0/2] git add --edit Junio C Hamano
2008-06-06 13:59                           ` Johannes Schindelin
2008-06-05 23:22                       ` [PATCH v2 1/2] Allow git-apply to ignore the hunk headers Junio C Hamano
2008-06-05 23:36                         ` Johannes Schindelin
2008-06-06  7:02                           ` Paolo Bonzini
2008-06-06 14:04                             ` Johannes Schindelin
2008-06-06 10:33                         ` Sergei Organov
2008-06-06 14:27                           ` Johannes Schindelin
2008-06-06 15:14                           ` Junio C Hamano
2008-06-05 16:20                 ` [PATCH v2 2/2] git-add: introduce --edit (to edit the diff vs. the index) Johannes Schindelin
2008-06-05 18:12                   ` Pieter de Bie
2008-06-05 18:39         ` [PATCH 1/2] Allow git-apply to fix up the line counts Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4847F49F.8090004@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).