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

Re: [PATCH 1/2] test-path-utils.c: remove incorrect assumption

From
Ray Donnelly <mingw.android@gmail.com>
Date
Oct 4, 2015, 23:36 UTC
Message-ID
<CAOYw7duDLWYpu+NK2t2+hV3rtU=dK3eQ6R11mfwLKbQQowbWuQ@mail.gmail.com>
In-Reply-To
<xmqqwpv21rej.fsf@gitster.mtv.corp.google.com>
On Sun, Oct 4, 2015 at 6:21 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 25 quoted lines
> Ray Donnelly <mingw.android@gmail.com> writes:
>
>>> Some callers of this function in real code (i.e. not the one you are
>>> removing the check) do seem to depend on that condition, e.g. the
>>> codepath in clone that leads to add_to_alternates_file() wants to
>>> make sure it does not add an duplicate, so it may end up not noticing
>>> /foo/bar and /foo/bar/ are the same thing, no?  There may be others.
>>
>> Enforcing that normalize_path_copy() removes any trailing '/' (apart
>> from the root directory) breaks other things that assume it doesn't
>> mess with trailing '/'s, for example filtering in ls-tree. Any
>> suggestions for what to do about this? Would a flag be appropriate as
>> to whether to do this part or not? Though I'll admit I don't like the
>> idea of adding flags to modify the behavior of something that's meant
>> to "normalize" something. Alternatively, I could go through all the
>> breakages and try to fix them up?
>
> I agree with you that "normalize" should "normalize".  Making sure
> that all the callers expect the same kind of normalization would be
> a lot of work but I do think that is the best approach in the long
> run.  Thanks for the ls-tree example, by the way, did you find it by
> code inspection?  I do not think it is reasonable to expect the test
> coverage for this to be 100%, so the "try to fix them up" would have
> to involve a lot of manual work both in fixing and reviewing,
> unfortunately.

For the ls-tree failure, I ran "make test" to see how much fell out. I'm not familiar with the code-base yet, so I figured that at least investigating the changes needed to make the test-suite pass would be a good entry point to reading the code; I will study it at the same time to try and get my bearings.

Show 6 quoted lines
>
> The first step of the "best approach" would be to make a note on
> normalize_path_copy() by adding a NEEDSWORK: comment to describe the
> situation.
>
> Thanks.
Previous: Junio C HamanoNext: Ray Donnelly
Message 6 of 9 in “test-path-utils.c: remove incorrect assumption”
  1. 1/2 test-path-utils.c: remove incorrect assumptionRay Donnelly, Oct 3, 2015
  2. Ray DonnellyOct 3, 2015
  3. Junio C HamanoOct 3, 2015
  4. Ray DonnellyOct 4, 2015
  5. Junio C HamanoOct 4, 2015
  6. Ray DonnellyOct 4, 2015
  7. Ray DonnellyOct 8, 2015
  8. Junio C HamanoOct 9, 2015
  9. Ray DonnellyOct 9, 2015

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.