All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] git-p4: remove deprecated function "encodeWithUTF8()"
@ 2021-02-03 16:57 Feiyang via GitGitGadget
  2021-02-03 20:06 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Feiyang via GitGitGadget @ 2021-02-03 16:57 UTC (permalink / raw)
  To: git; +Cc: Feiyang, Feiynag Xue

From: Feiynag Xue <fxue@roku.com>

commit d38208a297e76bbfbfa8e485632c217aaafa9486 introduced function "decode_path()" to replace "encodeWithUTF8()". This old function "encodeWithUTF8()" no longer has reference by any code in this file.

Signed-off-by: Feiynag Xue <fxue@roku.com>
---
    Remove deprecated function "encodeWithUTF8()"
    
    The function encodeWithUTF8() no longer has reference after
    d38208a297e76bbfbfa8e485632c217aaafa9486, which introduced decode_path()
    to replace encodeWithUTF8() for path encoding handling. I cannot think
    of a reason to keep encodeWithUTF8() in the codebase.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-862%2Ffeiyeung%2Fremove-encodeWithUTF8-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-862/feiyeung/remove-encodeWithUTF8-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/862

 git-p4.py | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/git-p4.py b/git-p4.py
index 09c9e93ac40..2c7e5498afa 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2939,18 +2939,6 @@ def writeToGitStream(self, gitMode, relPath, contents):
             self.gitStream.write(d)
         self.gitStream.write('\n')
 
-    def encodeWithUTF8(self, path):
-        try:
-            path.decode('ascii')
-        except:
-            encoding = 'utf8'
-            if gitConfig('git-p4.pathEncoding'):
-                encoding = gitConfig('git-p4.pathEncoding')
-            path = path.decode(encoding, 'replace').encode('utf8', 'replace')
-            if self.verbose:
-                print('Path with non-ASCII characters detected. Used %s to encode: %s ' % (encoding, path))
-        return path
-
     # output one file from the P4 stream
     # - helper for streamP4Files
 

base-commit: e6362826a0409539642a5738db61827e5978e2e4
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] git-p4: remove deprecated function "encodeWithUTF8()"
  2021-02-03 16:57 [PATCH] git-p4: remove deprecated function "encodeWithUTF8()" Feiyang via GitGitGadget
@ 2021-02-03 20:06 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2021-02-03 20:06 UTC (permalink / raw)
  To: Feiyang via GitGitGadget
  Cc: git, Feiyang, Feiynag Xue, Luke Diamand, Yang Zhao

"Feiyang via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Feiynag Xue <fxue@roku.com>
>
> commit d38208a297e76bbfbfa8e485632c217aaafa9486 introduced function "decode_path()" to replace "encodeWithUTF8()". This old function "encodeWithUTF8()" no longer has reference by any code in this file.
>
> Signed-off-by: Feiynag Xue <fxue@roku.com>

 - Please line-wrap your log message to reasonable length, like around
   70 columns.

 - We refer to an existing commit like this: d38208a2 (git-p4:
   convert path to unicode before processing them, 2019-12-13)

   You can ask "git show -s --pretty=reference d38208a2" to produce
   such a string with versions of Git that are recent enough (like
   v2.25 or newer), or --pretty='format:%h (%s, %ad)' can be used
   instead of --pretty=reference for older version of Git.

 - Please Cc: those who are likely to know the area to ask for their
   reviews.  This patch addresses a fallout from an existing commit,
   and its author would be a good candidate.

 - "deprecated" is probably not the word you wanted to use here, as
   it has a connotation that something was suboptimal with it, and
   it got replaced by something else.  Reading your description, I
   think you are removing a function that is no longer used.

   I'd suggest rewriting it to something like:

     Subject: git-p4: remove "encodeWithUTF8()" that is no longer used

     d38208a2 (git-p4: convert path to unicode before processing
     them, 2019-12-13) introduced the function "decode_path()" to
     replace the "encodeWithUTF8()" method of P4Sync class, which no
     longer is used anywhere.

     Remove it.

Thanks.

>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-862%2Ffeiyeung%2Fremove-encodeWithUTF8-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-862/feiyeung/remove-encodeWithUTF8-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/862
>
>  git-p4.py | 12 ------------
>  1 file changed, 12 deletions(-)
>
> diff --git a/git-p4.py b/git-p4.py
> index 09c9e93ac40..2c7e5498afa 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -2939,18 +2939,6 @@ def writeToGitStream(self, gitMode, relPath, contents):
>              self.gitStream.write(d)
>          self.gitStream.write('\n')
>  
> -    def encodeWithUTF8(self, path):
> -        try:
> -            path.decode('ascii')
> -        except:
> -            encoding = 'utf8'
> -            if gitConfig('git-p4.pathEncoding'):
> -                encoding = gitConfig('git-p4.pathEncoding')
> -            path = path.decode(encoding, 'replace').encode('utf8', 'replace')
> -            if self.verbose:
> -                print('Path with non-ASCII characters detected. Used %s to encode: %s ' % (encoding, path))
> -        return path
> -
>      # output one file from the P4 stream
>      # - helper for streamP4Files
>  
>
> base-commit: e6362826a0409539642a5738db61827e5978e2e4

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-03 20:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03 16:57 [PATCH] git-p4: remove deprecated function "encodeWithUTF8()" Feiyang via GitGitGadget
2021-02-03 20:06 ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.