git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Kerry, Richard" <richard.kerry@atos.net>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Cc: Pratyush Yadav <me@yadavpratyush.com>,
	"J. Paul Reed" <preed@sigkill.com>
Subject: RE: git-gui patch staging errors
Date: Tue, 12 May 2020 14:27:22 +0000	[thread overview]
Message-ID: <AM0PR02MB371505CA3EE36FBDB44B3A409CBE0@AM0PR02MB3715.eurprd02.prod.outlook.com> (raw)
In-Reply-To: <20200512121511.dyyd6n5gdfbesy2j@yadavpratyush.com>


-----Original Message-----
From: git-owner@vger.kernel.org <git-owner@vger.kernel.org> On Behalf Of Pratyush Yadav
Sent: 12 May 2020 13:15
To: J. Paul Reed <preed@sigkill.com>
Cc: git@vger.kernel.org
Subject: Re: git-gui patch staging errors

Hi,

On 11/05/20 06:07PM, J. Paul Reed wrote:
> 
> Hey all,
> 
> I ran into an interesting problem this week where git gui was erroring 
> out on staging partial patches in a particular file I was working on.
> 
> I worked around it with "git add -i," which worked like a champ.
> 
> I later realized the source file has some special characters (Unicode,
> probably) in it to print emojis (or colors or whatever fun animations 
> the kids want on their terminals these days).
> 
> Interestingly, lines/hunks before the first Unicode character will 
> partial-stage appropriately, but attempting to stage any hunks/lines 
> after the characters produces a "Failed to stage selected line. error: 
> patch failed ... error: ... patch does not apply" error dialog.
> 
> This can be reproduced by cloning
I can't reproduce it. I cloned the repo and then edited the file at line
60 with a diff that looks something like:

  diff --git a/glacierupload.sh b/glacierupload.sh
  index 3b956c7..265349b 100755
  --- a/glacierupload.sh
  +++ b/glacierupload.sh
  @@ -57,7 +57,9 @@ fi
   
   # count the number of files that begin with "$prefix"
   fileCount=$(ls -1 | grep "^$prefix" | wc -l)
  -echo "📦 Glacier Upload with $AWS_PROFILE"
  +bar
  +echo "📦 Glacier s Upload with $AWS_PROFILE"
  +foo
   echo "Total parts to upload: " $fileCount
   
   # get the list of part files to upload.  Edit this if you chose a different prefix in the split command

I tried a bunch of combinations if partially staging parts of this diff, but everything worked fine without any error message. The emoji didn't render properly (though that might be my font's problem), but there were no problems in partial staging or unstaging.

Does this example work fine on your system or does it error out? Could you give an example diff where git-gui has problems while staging? Maybe something in your config is different?
 
> Removing these control characters seems to calm git gui's indigestion 
> on this file.
> 
> [preed@underworld ~]$ git --version
> git version 2.26.2
> [preed@underworld ~]$ git gui --version git-gui version 
> 0.21.0.66.ga5728
> 
> best,
> preed

-----------------------

I've recently found  something very similar to this using the Fork Gui.  I am tempted to report it to that project, but on seeing something similar here perhaps both Fork and Gut-Gui have a similar issue relating to Gui applications for Git?
If the chunk I want to stage includes characters  in some category [1], then an attempt to Stage that chunk will fail with a similar fault to what is described here.  (I don't have one available to me at the moment to check whether it is exactly this failure)
I have recently found myself cutting and pasting some chunks of text from a PDF into my C++ source, and in particular that includes "handed" quotes, rather than the usual use of the usual single quote character (ie the apostrophe).  If I then use Fork's ability to Stage chunks of text containing these (or possibly not containing, but close after) I get this failure reported.
The work-around is to do it from the command line using "git add --patch", which works fine.

Regards,
Richard.

[1] 
I can't be entirely sure of the category as I haven't looked for the codes yet, but it is presumably some group of characters outside the basic ASCII page.

PS Sorry about posting style, I'm using Outlook and I've yet to find a way of getting it to help out by indenting everything using ">".



  reply	other threads:[~2020-05-12 14:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12  1:07 git-gui patch staging errors J. Paul Reed
2020-05-12 12:15 ` Pratyush Yadav
2020-05-12 14:27   ` Kerry, Richard [this message]
2020-05-12 19:00     ` Pratyush Yadav
2020-05-12 20:42     ` J. Paul Reed
2020-05-25 13:08       ` Pratyush Yadav
2020-07-26 22:15         ` J. Paul Reed

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=AM0PR02MB371505CA3EE36FBDB44B3A409CBE0@AM0PR02MB3715.eurprd02.prod.outlook.com \
    --to=richard.kerry@atos.net \
    --cc=git@vger.kernel.org \
    --cc=me@yadavpratyush.com \
    --cc=preed@sigkill.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).