git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Phillip Wood <phillip.wood@talktalk.net>
To: mqudsi <mqudsi@neosmart.net>, git@vger.kernel.org
Cc: "Martin Ågren" <martin.agren@gmail.com>
Subject: Re: Regression in patch add?
Date: Mon, 16 Apr 2018 11:00:53 +0100	[thread overview]
Message-ID: <20828345-bd21-3c45-a899-e6a97910d663@talktalk.net> (raw)
In-Reply-To: <01010162c940b8bb-d8139971-3ee2-4cd6-bb19-35126d46753b-000000@us-west-2.amazonses.com>

On 15/04/18 13:21, mqudsi wrote:
> 
> Hello all,
> 
> I'm currently running the latest version of git built from `master`, and
> I'm running into what appears to be a regression in the behavior of the
> piecewise `git add -p` when applying a manually edited chunk.
> 
> I first run `git add -p`, then manually edit a chunk (after hitting `s`
> once, if it matters).

Thanks for mentioning that, it can matter as the code that stitches
split hunks back together can't cope with edited hunks properly (though
the code that checks the hunk immediately after it's been edited doesn't
bother to try and stitch things back together).

> The chunk originally contains the following:
> 
> ```diff
> # Manual hunk edit mode -- see bottom for a quick guide
> @@ -20,7 +20,7 @@
>  	"call dein#add('Shougo/dein.vim', {'rev': 'master'})
> 
>  	" Add or remove your plugins here:
> -	" call dein#add('flazz/vim-colorschemes')
> -	call dein#add('Haron-Prime/evening_vim')
> +	call dein#add('flazz/vim-colorschemes')
> +	call dein#add('danilo-augusto/vim-afterglow')
> 
>  	"core plugins that change the behavior of vim and how we use it globally
> ```
> 
> Under git 2.7.4, I can edit it to the following, which is accepted
> without a problem:
> 
> ```diff
> # Manual hunk edit mode -- see bottom for a quick guide
> @@ -20,7 +20,7 @@
> 	"call dein#add('Shougo/dein.vim', {'rev': 'master'})
> 
> 	" Add or remove your plugins here:
> -	" call dein#add('flazz/vim-colorschemes')
> -	call dein#add('Haron-Prime/evening_vim')
> +	call dein#add('flazz/vim-colorschemes')
> +	call dein#add('Haron-Prime/evening_vim')
> 
> 	"core plugins that change the behavior of vim and how we use it globally
> ```
> 
> All I did here was remove one `+` line and manually add another (which
> is a variant of the second `-` line).
> 
> Under git 2.17.0.252.gfe0a9ea, the same piece is opened in $VISUAL for
> editing (and if left unmodified applies OK), but when modified in the
> to the same exact value, after exiting the editor I receive the
> following error from git:
> 
>     error: patch fragment without header at line 15: @@ -25,7 +25,8 @@

I'm not quite sure what that error message is telling us, I need to
spend some time understanding the code in apply.c that creates this
error message.

I assume that the header is coming from the next hunk which was created
when you split the original hunk. If you could post the original hunk
before it was split and the hunk starting at line 25 after it was split
that might help.

As Martin said if you could share the files or come up with a
reproducible example that would really help in figuring out what is
going wrong.

Thanks for reporting this

Phillip


> I'm not sure what to make of this.
> 
> Thank you,
> 
> Mahmoud Al-Qudsi
> NeoSmart Technologies
> 
> 


  parent reply	other threads:[~2018-04-16 10:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-15 12:21 Regression in patch add? mqudsi
2018-04-15 13:59 ` Martin Ågren
2018-04-16 10:01   ` Phillip Wood
2018-04-16 10:00 ` Phillip Wood [this message]
2018-05-10 10:41 ` Oliver Joseph Ash
2018-05-10 12:17   ` Martin Ågren
2018-05-10 13:16     ` Oliver Joseph Ash
2018-05-10 13:54       ` Martin Ågren
2018-05-10 13:49     ` Phillip Wood
2018-05-10 14:11       ` Oliver Joseph Ash
2018-05-10 17:58         ` Phillip Wood
2018-05-11  2:47           ` Junio C Hamano
2018-05-11 18:23             ` Phillip Wood
2018-05-10 13:15 ` Oliver Joseph Ash
2018-06-01 17:46 ` [PATCH] add -p: fix counting empty context lines in edited patches Phillip Wood
2018-06-01 19:07   ` Jacob Keller
2018-06-01 20:03   ` Eric Sunshine
2018-06-04 10:08     ` Phillip Wood
2018-06-04 17:21       ` Eric Sunshine
2018-06-11  9:46   ` [PATCH v2] " Phillip Wood
2018-07-11 20:27     ` Jeff Felchner
2018-07-11 20:50       ` 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=20828345-bd21-3c45-a899-e6a97910d663@talktalk.net \
    --to=phillip.wood@talktalk.net \
    --cc=git@vger.kernel.org \
    --cc=martin.agren@gmail.com \
    --cc=mqudsi@neosmart.net \
    --cc=phillip.wood@dunelm.org.uk \
    /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).