{"thread":{"id":"55096","subject":"[PATCH] git-p4: remove deprecated function \"encodeWithUTF8()\"","startedAt":"2021-02-03T17:00:56Z","lastAt":"2021-02-03T20:07:36Z","messageCount":2,"participants":["Feiyang via GitGitGadget","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"416062","messageId":"pull.862.git.1612371471347.gitgitgadget@gmail.com","threadId":"55096","inReplyTo":null,"subject":"[PATCH] git-p4: remove deprecated function \"encodeWithUTF8()\"","fromName":"Feiyang via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-02-03T16:57:50Z","receivedAt":"2021-02-03T17:00:56Z","isPatch":true,"sender":{"key":"name:Feiyang","avatar":null},"body":"From: Feiynag Xue <fxue@roku.com>\n\ncommit d38208a297e76bbfbfa8e485632c217aaafa9486 introduced function \"decode_path()\" to replace \"encodeWithUTF8()\". This old function \"encodeWithUTF8()\" no longer has reference by any code in this file.\n\nSigned-off-by: Feiynag Xue <fxue@roku.com>\n---\n    Remove deprecated function \"encodeWithUTF8()\"\n    \n    The function encodeWithUTF8() no longer has reference after\n    d38208a297e76bbfbfa8e485632c217aaafa9486, which introduced decode_path()\n    to replace encodeWithUTF8() for path encoding handling. I cannot think\n    of a reason to keep encodeWithUTF8() in the codebase.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-862%2Ffeiyeung%2Fremove-encodeWithUTF8-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-862/feiyeung/remove-encodeWithUTF8-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/862\n\n git-p4.py | 12 ------------\n 1 file changed, 12 deletions(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 09c9e93ac40..2c7e5498afa 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -2939,18 +2939,6 @@ def writeToGitStream(self, gitMode, relPath, contents):\n             self.gitStream.write(d)\n         self.gitStream.write('\\n')\n \n-    def encodeWithUTF8(self, path):\n-        try:\n-            path.decode('ascii')\n-        except:\n-            encoding = 'utf8'\n-            if gitConfig('git-p4.pathEncoding'):\n-                encoding = gitConfig('git-p4.pathEncoding')\n-            path = path.decode(encoding, 'replace').encode('utf8', 'replace')\n-            if self.verbose:\n-                print('Path with non-ASCII characters detected. Used %s to encode: %s ' % (encoding, path))\n-        return path\n-\n     # output one file from the P4 stream\n     # - helper for streamP4Files\n \n\nbase-commit: e6362826a0409539642a5738db61827e5978e2e4\n-- \ngitgitgadget\n"},{"id":"416086","messageId":"xmqqtuqsc3vt.fsf@gitster.c.googlers.com","threadId":"55096","inReplyTo":"pull.862.git.1612371471347.gitgitgadget@gmail.com","subject":"Re: [PATCH] git-p4: remove deprecated function \"encodeWithUTF8()\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-02-03T20:06:46Z","receivedAt":"2021-02-03T20:07:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Feiyang via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Feiynag Xue <fxue@roku.com>\n>\n> commit d38208a297e76bbfbfa8e485632c217aaafa9486 introduced function \"decode_path()\" to replace \"encodeWithUTF8()\". This old function \"encodeWithUTF8()\" no longer has reference by any code in this file.\n>\n> Signed-off-by: Feiynag Xue <fxue@roku.com>\n\n - Please line-wrap your log message to reasonable length, like around\n   70 columns.\n\n - We refer to an existing commit like this: d38208a2 (git-p4:\n   convert path to unicode before processing them, 2019-12-13)\n\n   You can ask \"git show -s --pretty=reference d38208a2\" to produce\n   such a string with versions of Git that are recent enough (like\n   v2.25 or newer), or --pretty='format:%h (%s, %ad)' can be used\n   instead of --pretty=reference for older version of Git.\n\n - Please Cc: those who are likely to know the area to ask for their\n   reviews.  This patch addresses a fallout from an existing commit,\n   and its author would be a good candidate.\n\n - \"deprecated\" is probably not the word you wanted to use here, as\n   it has a connotation that something was suboptimal with it, and\n   it got replaced by something else.  Reading your description, I\n   think you are removing a function that is no longer used.\n\n   I'd suggest rewriting it to something like:\n\n     Subject: git-p4: remove \"encodeWithUTF8()\" that is no longer used\n\n     d38208a2 (git-p4: convert path to unicode before processing\n     them, 2019-12-13) introduced the function \"decode_path()\" to\n     replace the \"encodeWithUTF8()\" method of P4Sync class, which no\n     longer is used anywhere.\n\n     Remove it.\n\nThanks.\n\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-862%2Ffeiyeung%2Fremove-encodeWithUTF8-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-862/feiyeung/remove-encodeWithUTF8-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/862\n>\n>  git-p4.py | 12 ------------\n>  1 file changed, 12 deletions(-)\n>\n> diff --git a/git-p4.py b/git-p4.py\n> index 09c9e93ac40..2c7e5498afa 100755\n> --- a/git-p4.py\n> +++ b/git-p4.py\n> @@ -2939,18 +2939,6 @@ def writeToGitStream(self, gitMode, relPath, contents):\n>              self.gitStream.write(d)\n>          self.gitStream.write('\\n')\n>  \n> -    def encodeWithUTF8(self, path):\n> -        try:\n> -            path.decode('ascii')\n> -        except:\n> -            encoding = 'utf8'\n> -            if gitConfig('git-p4.pathEncoding'):\n> -                encoding = gitConfig('git-p4.pathEncoding')\n> -            path = path.decode(encoding, 'replace').encode('utf8', 'replace')\n> -            if self.verbose:\n> -                print('Path with non-ASCII characters detected. Used %s to encode: %s ' % (encoding, path))\n> -        return path\n> -\n>      # output one file from the P4 stream\n>      # - helper for streamP4Files\n>  \n>\n> base-commit: e6362826a0409539642a5738db61827e5978e2e4\n"}]}