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

Re: Tracking empty directories

From
KFKevin P. Fleming <kpfleming@digium.com>
Date
Feb 2, 2011, 12:31 UTC
Message-ID
<4D494EAA.2060803@digium.com>
In-Reply-To
<AANLkTikkymYmnXh7XB1SM8br_oK-YmAJYfkwjTuLzr+f@mail.gmail.com>
On 02/01/2011 09:54 PM, Nguyen Thai Ngoc Duy wrote:
Show 21 quoted lines
> On Wed, Feb 2, 2011 at 2:03 AM, Jakub Narebski<jnareb@gmail.com>  wrote:
>>> To add, one would use "git update-index --add".
>>
>> Porcelain version could be "git add -N<directory>", don't you agree?
>
> "git add" is recursive, with or without -N. What I worry is user
> accidentally "git add -N<dir>" where<dir>  is not empty, which adds
> everything in<dir>.
>
>>> The magic disappears when you register a file within that directory;
>>> to tell git you want to keep it, one would mkdir and
>>> "git update-index --add" again.  Once it's working, we can think about
>>> if there is a need for making that last step automatic after all
>>> (my guess: "no"). ;-)
>>
>> Hmmm... could we use mechanism similar to assume-unchanged to mark
>> directory as explicitely tracked, and that git should not remove it
>> when it becomes empty?
>
> I think git-attr suits better, more persistent. Although if you insist
> the directory must stay, why not just put a hidden file in there?

That's what I do now... in fact, since the empty directory needs to exist in checkouts *and* be empty, adding a .gitignore file with content '*' works quite well.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kfleming@digium.com
Check us out at www.digium.com & www.asterisk.org
Previous: Nguyen Thai Ngoc DuyNext: Nicolas Pitre
Message 30 of 36 in “Features from GitSurvey 2010”
  1. Dmitry S. KravtsovJan 29, 2011
  2. Jonathan NiederJan 29, 2011
  3. Jakub NarebskiFeb 1, 2011
  4. Nguyen Thai Ngoc DuyFeb 1, 2011
  5. Shawn PearceFeb 1, 2011
  6. Shawn PearceFeb 1, 2011
  7. Nguyen Thai Ngoc DuyFeb 1, 2011
  8. Junio C HamanoFeb 1, 2011
  9. Nicolas PitreFeb 1, 2011
  10. Nguyen Thai Ngoc DuyFeb 1, 2011
  11. Shawn PearceFeb 1, 2011
  12. Nicolas PitreFeb 1, 2011
  13. Shawn PearceFeb 2, 2011
  14. Nicolas PitreFeb 2, 2011
  15. david@lang.hmFeb 2, 2011
  16. Geert BoschFeb 3, 2011
  17. Narrow clone (Re: features from GitSurvey 2010)Jonathan Nieder, Feb 3, 2011
  18. Geert BoschFeb 3, 2011
  19. Jonathan NiederFeb 3, 2011
  20. Jonathan NiederFeb 3, 2011
  21. Nicolas PitreFeb 3, 2011
  22. Tracking empty directoriesJonathan Nieder, Feb 1, 2011
  23. Nguyen Thai Ngoc DuyFeb 1, 2011
  24. Ilari LiusvaaraFeb 1, 2011
  25. Jakub NarebskiFeb 1, 2011
  26. Ilari LiusvaaraFeb 1, 2011
  27. Jonathan NiederFeb 1, 2011
  28. Jakub NarebskiFeb 1, 2011
  29. Nguyen Thai Ngoc DuyFeb 2, 2011
  30. Kevin P. FlemingFeb 2, 2011
  31. Nicolas PitreFeb 1, 2011
  32. big files in git was: Re: Features from GitSurvey 2010david@lang.hm, Feb 1, 2011
  33. Nicolas PitreFeb 3, 2011
  34. Matthieu MoyFeb 1, 2011
  35. Jonathan NiederFeb 1, 2011
  36. Matthieu MoyFeb 1, 2011

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.