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

Re: [PATCH 1/2] submodule--helper, module_clone: always operate on absolute paths

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Apr 1, 2016, 20:09 UTC
Message-ID
<CAPig+cSDNLvBYLUc1VvPoS=dQX9P3YCCiZVHcZ91MqCHZpf_dg@mail.gmail.com>
In-Reply-To
<xmqq37r5i0tv.fsf@gitster.mtv.corp.google.com>
On Fri, Apr 1, 2016 at 3:30 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 14 quoted lines
> Subject: [PATCH] submodule--helper: do not borrow absolute_path() result for too long
>
> absolute_path() is designed to allow its callers to take a brief
> peek of the result (typically, to be fed to functions like
> strbuf_add() and relative_path() as a parameter) without having to
> worry about freeing it, but the other side of the coin of that
> memory model is that the caller shouldn't rely too much on the
> result living forever--there may be a helper function the caller
> subsequently calls that makes its own call to absolute_path(),
> invalidating the earlier result.
>
> Use xstrdup() to make our own copy, and free(3) it when we are done.
> While at it, remove an unnecessary sm_gitdir_rel variable that was
> only used to as a parameter to call absolute_paht() and never used
s/absolute_paht/absolute_path/
> again.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 15 in “[PATCHv3 0/2] Fix relative path issues in recursive submodules.”
  1. Stefan BellerApr 1, 2016
  2. 1/2 submodule--helper, module_clone: always operate on absolute pathsStefan Beller, Apr 1, 2016
  3. Junio C HamanoApr 1, 2016
  4. Junio C HamanoApr 1, 2016
  5. Eric SunshineApr 1, 2016
  6. Junio C HamanoApr 1, 2016
  7. 2/2 submodule--helper, module_clone: catch fprintf failureStefan Beller, Apr 1, 2016
  8. Ramsay JonesApr 1, 2016
  9. Stefan BellerApr 12, 2016
  10. Ramsay JonesApr 13, 2016
  11. Stefan BellerApr 13, 2016
  12. Junio C HamanoApr 13, 2016
  13. Stefan BellerApr 13, 2016
  14. Junio C HamanoApr 13, 2016
  15. Junio C HamanoApr 13, 2016

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.