Subject: Re: git-gui patch staging errors

From: "J. Paul Reed" <[email-masked]>
Date: Sun, 26 Jul 2020 15:15:08 -0700

Hey Pratyush,

Apologies for the late reply myself! Oof... been a long couple of months.

See further responses inline:

later,
preed
-- 
J. Paul Reed
https://jpaulreed.com
PGP: 0xDF8708F8

On 25 May 2020 at 18:38:07, Pratyush Yadav arranged the bits on my disk to say:

> Hi,
> 
> Sorry for the late reply.
> 
> On 12/05/20 01:42PM, J. Paul Reed wrote:
> > 
> > Hey Richard,
> 
> You replied to the wrong person ;-)

Sorry about that!

> I suspect it is some encoding mismatch. Can you apply this patch below 
> and send what the output is?
> 
> -- 8< --
> diff --git a/lib/diff.tcl b/lib/diff.tcl
> index 871ad48..6226a89 100644
> --- a/lib/diff.tcl
> +++ b/lib/diff.tcl
> @@ -851,8 +851,13 @@ proc apply_or_revert_range_or_line {x y revert} {
>  		set first_l [$ui_diff index "$next_l + 1 lines"]
>  	}
>  
> +	puts "Diff we will send to git-apply:"
> +	puts -nonewline "$current_diff_header"
> +	puts -nonewline "$wholepatch"
> +
>  	if {[catch {
>  		set enc [get_path_encoding $current_diff_path]
> +		puts "\nEncoding: $enc"
>  		set p [eval git_write $apply_cmd]
>  		fconfigure $p -translation binary -encoding $enc
>  		puts -nonewline $p $current_diff_header
> -- >8 --

Here ya go:

[preed@underworld aws-glacier-multipart-upload]$ ~/checkouts/git-gui/git-gui.sh 
Diff we will send to git-apply:
diff --git a/glacierupload.sh b/glacierupload.sh
index 3b956c7..c83150c 100755
--- a/glacierupload.sh
+++ b/glacierupload.sh
@@ -58,15 +58,14 @@
 # count the number of files that begin with "$prefix"
 fileCount=$(ls -1 | grep "^$prefix" | wc -l)
 echo "ð¦ Glacier Upload with $AWS_PROFILE"
 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
 files=$(ls | grep "^$prefix")
 
 # initiate multipart upload connection to glacier
-echo aws glacier initiate-multipart-upload --profile $AWS_PROFILE
--account-id - --part-size $byteSize --vault-name $vaultName
--archive-description "$description"
 init=$(aws glacier initiate-multipart-upload --profile $AWS_PROFILE
--account-id - --part-size $byteSize --vault-name $vaultName
--archive-description "$description")
 
 echo "---------------------------------------"
 # xargs trims off the quotes
 # jq pulls out the json element titled uploadId

Encoding: utf-8

This is probably expected, but to be clear: with this patch, I do still get
the error popup in the gui ("Failed to stage selected line; error: patch
failed: glacierupload:58 error: glacierupload.sh patch does not apply"