Fix /app/tmp gitignore trouble #711

Closed
wants to merge 2 commits into
from

6 participants

@Wolg

This fixes a small but really annoying thing.

@AD7six
CakePHP member

what is said thing?

Looks like change for the sake of change to me.

@markstory
CakePHP member

If we're going to change this here, we should also update the skel directory + bake's project task.

@rchavik
CakePHP member

I'm not getting the exact issue this addresses though. There has been no case where I would want to track anything in tmp.

@Wolg

@AD7six /app/tmp in .gitignore forces to ignore the whole directory.
So when working on each new project need to:
1) remove /app/tmp from .gitignore
2) git add /app/tmp (in each sub-directory should be empty file)
3) git commit
4) add app/tmp/ to .gitignore
It's pretty annoying every time you work on a new project.
Also empty files should be replaced with something starting with dot.
Related links:
http://stackoverflow.com/questions/2218075/using-git-with-your-cakephp-project
https://gist.github.com/956993
http://cakephp.lighthouseapp.com/projects/42648/tickets/1330-rfc-for-2x-empty-files-in-directories

@rchavik
CakePHP member

@Wolg

I'm not getting what your exact problem with app/tmp in .gitignore here.

You should not use the actual 'cakephp' clone and build your app on top of it anyway. It will be better if you bake a separate fresh project, then use the Advanced Installation method from the book to 'use' the separate cakephp repo.

@sitedyno

You don't want to track anything in tmp/ but you do want to track the tmp directory structure. IMO this is a better solution, just swap --empty with --gitignore. The files will only be created with Console/cake bake project myproj --gitignore

@rchavik
CakePHP member

@sitedyno sure, we can probably can change empty with .gitignore. My problem is this patch removes app/tmp from .gitignore

Have you seen output git status with app/tmp removed ? Well, Here's on mine: http://bin.cakephp.org/view/1657634564 and it does not look pretty

@rchavik
CakePHP member

nevermind. i'm a derp.

@uzyn

Don't see the point of this.

@Wolg you can forcefully add a file to git even if the dir is in .gitignore. git add -f app/tmp/logs/empty

@AD7six
CakePHP member

@AD7six /app/tmp in .gitignore forces to ignore the whole directory.

Well yes, that's the point.

So when working on each new project need to:
1) remove /app/tmp from .gitignore
2) git add /app/tmp (in each sub-directory should be empty file)
3) git commit
4) add app/tmp/ to .gitignore

OR

1) git add -f tmp

Also empty files should be replaced with something starting with dot.

Why?

Related links:

All of these links demonstrate some level of git-misunderstanding. Like why would you keep a file named "empty" in a folder that is not empty?

Creating a project

A git ignore rule only applies to untracked files - as soon as you've added the file to your repository - the contents of a .gitignore file are irrelevant; or in other words it applies only to day 0 of a project.

I'd rather fix a missing tmp dir structure by having it created on demand, but in any case this isn't IMO hard:

git init
git add *
git add tmp -f
git add .htaccess

About the pull request

What you've done is put a .gitignore file in all sub folders of the tmp structure. what about files in the top folder: /tmp ? or any other subfolders that your app creates?

There are other places that use empty files - what about them?

Know that the empty file doesn't just serve a purpose for git, I assume there will still be some users who download a release of cake, and use ftp to move things around. The empty files were originally to prevent crappy ftp clients from forgetting to create empty folders. We still get from time to time questions on the group about missing .htaccess files - I wouldn't be surprised if moving from empty to .gitignore files amplifies these sort of problems.

So all in all I'm obviously -1 on this.

@Wolg

@AD7six thanks for the detailed response.

Also empty files should be replaced with something starting with dot.

Why?

Just as I know, people who want to track empty directories in Git puts files called .gitignore or .gitkeep in these directories.
Also currently there two empty files in webroot directory and IMO it's not a good solution.

1) git add -f tmp

looks useful for me.

There are other places that use empty files - what about them?

I see 2 options here:
1) replace all empty files with .gitignore files. Some .gitignore files will contain the content about what things to ignore (where is necessary) and some will be empty.
2) replace all empty files with combination of .gitignore and .gitkeep files (will be used where there is nothing to ignore).

Make sense?

@AD7six
CakePHP member

I see 2 options here:

To have git 'track' an empty folder it just needs a file - any file - and the name of the file is absolutely not important to git itself. There are various conventions (but they are just that - conventions); an empty .gitignore file is one, and an empty .gitkeep file is another. If we're going to rename empty to anything - I'd be happiest to rename it to an empty .gitignore file - it's a file which at least serves some potential purpose.

I still dislike that - It doesn't really change anything from right now, it just changes the name of an empty file from x to y with no perceived (at least, obviously, by me) benefit.

@Wolg Wolg closed this Jul 12, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment