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

Re: [PATCH v2] archive: make --add-virtual-file honor --prefix

From
TSTom Scogland <scogland1@llnl.gov>
Date
May 20, 2024, 16:10 UTC
Message-ID
<95B94723-BCBF-48B4-A02C-A5C61FB060DA@llnl.gov>
In-Reply-To
<bc3711a7-37d5-46bc-979e-83bd0b2cf900@web.de>
On 19 May 2024, at 6:25, René Scharfe wrote:
Show 12 quoted lines
>
> Aligning code and docs is a good idea.  Have you considered keeping the
> code as is and changing the documentation instead, though?
>
> The two options are related in that they both add untracked files, but
> they necessarily have different arguments:
>
>    --add-file=<file>
>    --add-virtual-file=<path>:<content>
>
> You can already specify any path you want with --add-virtual-file.
> What's the advantage of honoring --prefix as well?
I came into this after trying to translate an --add-file to an --add-virtual-file and being surprised that the prefix wasn't applied. anything else you add, in the repo or not, it gets the prefix. I can go back and explicitly add the prefix, but it makes the options less naturally composable in my opinion.  The specific case was packaging some software that uses git metadata to set version and some other things when in a repo, and files in a tarball. The tarball's prefix is set in one part of the packaging code, files and exclusions in another, and passing that through was something we didn't have to think about using add-file, but do with add-virtual-file.
That said, it sounds like both you and Junio prefer updating the docs rather than the code, which makes me think I'm in the minority in that opinion.  If that's the case, I can certainly update the docs, and I imagine we can backport that easily wherever it makes sense.  I would really like to have the option to have the prefix apply though, either adding a new flag or an option to the existing one that would be invalid given current syntax or similar to provide the option.
Previous: René ScharfeNext: René Scharfe
Message 8 of 14 in “archive: make --add-virtual-file honor --prefix”
  1. archive: make --add-virtual-file honor --prefixTom Scogland via GitGitGadget, May 14, 2024
  2. Junio C HamanoMay 15, 2024
  3. Tom ScoglandMay 15, 2024
  4. archive: make --add-virtual-file honor --prefixTom Scogland via GitGitGadget, May 17, 2024
  5. Junio C HamanoMay 17, 2024
  6. Tom ScoglandMay 18, 2024
  7. René ScharfeMay 19, 2024
  8. Tom ScoglandMay 20, 2024
  9. René ScharfeMay 20, 2024
  10. Junio C HamanoJun 14, 2024
  11. archive: document that --add-virtual-file takes full pathJunio C Hamano, Jun 14, 2024
  12. Junio C HamanoJun 25, 2024
  13. René ScharfeJun 26, 2024
  14. Junio C HamanoMay 20, 2024

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.