git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v1] git-p4: fix git-p4.pathEncoding for removed files

From
Luke Diamand <luke@diamand.org>
Date
Dec 20, 2016, 11:01 UTC
Message-ID
<CAE5ih7-=bD_ZoL5pFYfD2Qvy-XE24V_cgge0XoAvuoTK02EDfg@mail.gmail.com>
In-Reply-To
<xmqq37hjobf6.fsf@gitster.mtv.corp.google.com>
On 19 December 2016 at 21:29, Junio C Hamano <gitster@pobox.com> wrote:
Show 25 quoted lines
> larsxschneider@gmail.com writes:
>
>> From: Lars Schneider <larsxschneider@gmail.com>
>>
>> In a9e38359e3 we taught git-p4 a way to re-encode path names from what
>> was used in Perforce to UTF-8. This path re-encoding worked properly for
>> "added" paths. "Removed" paths were not re-encoded and therefore
>> different from the "added" paths. Consequently, these files were not
>> removed in a git-p4 cloned Git repository because the path names did not
>> match.
>>
>> Fix this by moving the re-encoding to a place that affects "added" and
>> "removed" paths. Add a test to demonstrate the issue.
>>
>> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
>> ---
>
> Thanks.
>
> The above description makes me wonder what happens to "modified"
> paths, but presumably they are handled in a separate codepath?  Or
> does this also cover not just "removed" but also paths with any
> change?
>
> Luke, does this look good?

I'm not totally sure. In the previous version the conversion happened in streamOneP4File(). There is a counterpart to this, streamOneP4Deletion() which would seem like the callpoint that needs to know about this.

The change puts the logic into stripRepoPath() instead, which is indeed called from both of those functions (good), but also from splitFilesIntoBranches(), but only if self.useClientSpec is set. That function only gets used if we're doing the automatic branch detection logic, so it's possible that this code might now be broken and we wouldn't know.

Lars, what do you think? Other than the above, the change looks good, so it may all be fine.

(As an aside, this is the heart of the code that's going to need some careful rework if/when we ever move to Python3).

Luke
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 8 in “git-p4: fix git-p4.pathEncoding for removed files”
  1. git-p4: fix git-p4.pathEncoding for removed fileslarsxschneider@gmail.com, Dec 18, 2016
  2. Junio C HamanoDec 19, 2016
  3. Luke DiamandDec 20, 2016
  4. Junio C HamanoDec 22, 2016
  5. git-p4: fix git-p4.pathEncoding for removed filesLars Schneider, Feb 9, 2017
  6. Junio C HamanoFeb 9, 2017
  7. Luke DiamandFeb 10, 2017
  8. Junio C HamanoFeb 10, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.