gitless icon indicating copy to clipboard operation
gitless copied to clipboard

Allow tracking empty directories

Open embs opened this issue 8 years ago • 2 comments

Handle creating and removing placeholders files for versioning empty directories as suggested in 1.

embs avatar Oct 21 '17 19:10 embs

@spderosso what do you think about this (demo)? There are probably some uncovered edge cases but I think this PR addresses the use case which seems to be the most common one (tracking directories structures which will be populated later) as suggest by some people here.

I'd really appreciate to know if you think we're missing some important thing.

Thanks!

embs avatar Dec 03 '17 21:12 embs

Sorry for my belated response, I got caught up with other things and I am just now catching up with Gitless. Thank you for the PR and for the demo (it really helps to see it working)! I think that adding support for dealing with empty directories is a great idea.

I am slightly concerned about implying that there are "tracked/untracked" directories. What's the difference between them? What does it mean for a directory to be tracked? I thought about this some time ago and I couldn't find a satisfying answer. For example, what happens if I untrack a directory that has files in it? There are lots of edge cases like this. If you have any thoughts, let me know!

Another alternative would be to retain the idea that files are the only things that can be tracked/untracked and we create the .glkeep file for users when they attempt to track a directory that has no files. As long as we are explicit about this I think that most users would understand what's going on. E.g, something like:

$ gl track empty-dir
! No files to track under empty-dir, creating .glkeep file
✓ .glkeep is now a tracked file

Then .glkeep behaves just like a normal file, so status would list it:

$ gl status
On branch ...

  empty-dir/.glkeep

But if you untrack a directory that only has the .glkeep file, we remove the file:

$ gl untrack empty-dir
! No files to untrack under empty-dir, removing .glkeep file
✓ .glkeep removed

What do you think?

spderosso avatar Feb 12 '18 01:02 spderosso