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

list empty dirs in commit message trailer

From
TKThomas Koch <thomas@koch.ro>
Date
Aug 18, 2015, 14:43 UTC
Message-ID
<2384709.cc1iR2nLxC@x121e>
Hi,

I had an idea how to deal with tracking empty directories in git repositories when one does not want ".gitkeep" files. Just add a trailer like:

empty-dirs: a b/c a\nnewline exploit\" &&\ rm\ -rf \/ ..

this line would indicate that the worktree contained the empty directories a and b/c and contains examples for possible shell quoting problems or exploits.

So one can not just run mkdir -p and the content of the line but needs safeguards.

A pre-commit hook could add such a line to the commit message and another tool could create the directories for HEAD. There is no staging in this approach for empty directories and no ignore mechanism. But for my current use case (represent the content of debian source packages) this would be enough.

Do you like the idea?
Regards,
Thomas Koch
Message 1 of 1 in “list empty dirs in commit message trailer”
  1. Thomas KochAug 18, 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.