Empty directories...

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Kastrup
Date: Tuesday, July 17, 2007 - 5:13 pm

GIT(7) -- 03/05/2007

NAME
	git - the stupid content tracker


Well, I use git for tracking contents.  That means, for example,
installation trees for some application.  Let's take a typical TeXlive
tree as an example.  Those trees contain, among other things,
directories where new fonts/formats/whatever get placed as things run.
Quite a few of them start out empty, but their permissions have to
correspond to their purpose (for example, some are world-writable).

I see little chance to get this achieved without doing something like

find -type d -empty -execdir touch {}/.git-this-is-empty +

before every checkin and

find -name .git-this-is-empty -exec rm -- {} +

after every checkout.  Which is pretty stupid.

As some anecdotal stuff, I did something like

mkdir test
cd test
git-init
touch README
git-add README # another peeve: why is no empty reference point possible?
git-commit -a -m "Initial branch"
git checkout -b newbranch master
unzip ../somearchive -d subdir
git add subdir
git commit -a -m "Add subdir"
git checkout -b newbranch2 master

and expect to have a clean slate.  No such luck: without warning, all
empty directories in the zip file are still remaining within subdir,
which as a consequence has not been cleaned up.

So even if one is of the opinion that empty directories are not worth
putting into the repository: if I check in an entire subdirectory
hierarchy and then switch to a branch where this subdirectory is not
existent, I expect the subdirectory to be _gone_, and not have some
littering of empty directories lying around.

And that git-diff can see nothing wrong with that does not really
improve things.

So if git is supposed to be a content tracker, I can't see a way
around it actually being able to track content, and empty directories
_are_ content.  It can't let them flying around with arbitrary
permissions on them when I switch branches or tags.  And the
workaround using "touch" mentioned above is really awful to do
manually all the time.

Could git technically track a file with a zero-length filename in
empty directories if one tells it explicitly to include it, like with
git-add \! -x "" subdir
or has somebody a better idea or interface or rationale?  I understand
that there are use cases where one does not bother about empty
directories, but for a _content_ tracker, not tracking directories
because they are empty seems quite serious.

Ok, kill me.  This must likely be the most common FAQ/rant/whatever
concerning git.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Empty directories..., David Kastrup, (Tue Jul 17, 5:13 pm)
Re: Empty directories..., Johannes Schindelin, (Tue Jul 17, 5:35 pm)
Re: Empty directories..., Matthieu Moy, (Tue Jul 17, 5:39 pm)
Re: Empty directories..., Junio C Hamano, (Tue Jul 17, 7:23 pm)
Re: Empty directories..., David Kastrup, (Tue Jul 17, 10:56 pm)
Re: Empty directories..., David Kastrup, (Tue Jul 17, 11:07 pm)
Re: Empty directories..., Wincent Colaiuta, (Tue Jul 17, 11:34 pm)
Re: Empty directories..., Junio C Hamano, (Tue Jul 17, 11:53 pm)
Re: Empty directories..., Johannes Schindelin, (Wed Jul 18, 3:26 am)
Re: Empty directories..., Linus Torvalds, (Wed Jul 18, 9:23 am)
Re: Empty directories..., Linus Torvalds, (Wed Jul 18, 9:33 am)
Re: Empty directories..., Matthieu Moy, (Wed Jul 18, 9:39 am)
Re: Empty directories..., Linus Torvalds, (Wed Jul 18, 10:06 am)
Re: Empty directories..., David Kastrup, (Wed Jul 18, 10:34 am)
Re: Empty directories..., David Kastrup, (Wed Jul 18, 10:38 am)
Re: Empty directories..., Linus Torvalds, (Wed Jul 18, 11:05 am)
Re: Empty directories..., David Kastrup, (Wed Jul 18, 2:37 pm)
Re: Empty directories..., Linus Torvalds, (Wed Jul 18, 2:45 pm)
Re: Empty directories..., David Kastrup, (Wed Jul 18, 4:13 pm)
[RFC PATCH] Re: Empty directories..., Linus Torvalds, (Wed Jul 18, 4:16 pm)
Re: [RFC PATCH] Re: Empty directories..., Linus Torvalds, (Wed Jul 18, 4:40 pm)
Re: [RFC PATCH] Re: Empty directories..., David Kastrup, (Wed Jul 18, 4:42 pm)
Re: [RFC PATCH] Re: Empty directories..., Linus Torvalds, (Wed Jul 18, 5:22 pm)
Re: [RFC PATCH] Re: Empty directories..., Junio C Hamano, (Wed Jul 18, 10:28 pm)
Re: [RFC PATCH] Re: Empty directories..., Shawn O. Pearce, (Wed Jul 18, 10:38 pm)
Re: [RFC PATCH] Re: Empty directories..., Shawn O. Pearce, (Wed Jul 18, 11:09 pm)
Re: [RFC PATCH] Re: Empty directories..., Matthieu Moy, (Thu Jul 19, 1:13 am)
Re: [RFC PATCH] Re: Empty directories..., Tomash Brechko, (Thu Jul 19, 3:51 am)
Re: [RFC PATCH] Re: Empty directories..., Johannes Schindelin, (Thu Jul 19, 5:16 am)
Re: Empty directories..., Johan Herland, (Fri Jul 20, 1:29 am)
Re: Empty directories..., Robin Rosenberg, (Thu Jul 26, 4:33 pm)
Re: Empty directories..., David Kastrup, (Thu Jul 26, 10:22 pm)