# Re: [PATCH] git-add--interactive: manual hunk editing mode

1 messages from 2008-07-02 to 2008-07-02. Participants: Thomas Rast.
Thread: https://gitlist.dev/t/14251

## Thomas Rast, 2008-07-02 09:03

Subject: Re: [PATCH] git-add--interactive: manual hunk editing mode
Message-ID: <200807021103.56570.trast@student.ethz.ch>
URL: https://gitlist.dev/e/200807021103.56570.trast%40student.ethz.ch

```
[Wrong button at first, sorry for the double mail Junio]

Junio C Hamano wrote:
> 
> If you change '-' to ' ', or remove '+', then you are temporarily
> reverting the change you have made since HEAD to your working tree copy.
> If you do not change anything, you are taking something that was in your
> working tree copy.  Both are simpler and easier to explain operations.
[...]
> Once you start to [support truly free editing of the hunk],
> you would need to worry about the case where
> the hunk extended to include later lines overlaps with the hunk after the
> one we are currently looking at, and run coalesce_overlapping_hunks to
> concatenate them into a larger single hunk.  But to be able to do that,
> you would need to keep track of the number of lines in a hunk yourself
> anyway, which would mean that you cannot rely on --recount anymore.  The
> extension recently made to "git apply" becomes redundant and unused code.
> 
> In short, declaring that you are supporting the use to change ' ' to '-'
> means you are opening a whole can of worms, and I asked the question
> because I did not know if you are really prepared to deal with it.

This issue is why I feed the entire patch (not just the edited hunk)
to git-apply --check.  That's really the only promise this feature
makes: if you hand it a patch that does not apply, it will refuse.  If
you do hand it a hunk where you manually inserted some extra context,
then added some extra changes that weren't in the original hunk, well,
tough.  (You asked for a gun _and_ loaded it _and_ pointed it at your
foot!)

That being said, we could of course add a notice of the form

  # Do not edit in any other ways unless you know what you are doing.

if that constitutes appropriate "trigger safety".

- Thomas

-- 
Thomas Rast
trast@student.ethz.ch





```
