Skip to content
This repository

Fix /app/tmp gitignore trouble #711

Closed
wants to merge 2 commits into from

6 participants

Stanislav Chistenko Andy Dawson Mark Story Rachman Chavik sitedyno U-Zyn Chua
Stanislav Chistenko
Wolg commented

This fixes a small but really annoying thing.

Andy Dawson
Collaborator
AD7six commented

what is said thing?

Looks like change for the sake of change to me.

Mark Story
Owner

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

Rachman Chavik
Collaborator

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

Stanislav Chistenko
Wolg commented

@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

Rachman Chavik
Collaborator

@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

Rachman Chavik
Collaborator

@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

Rachman Chavik
Collaborator

nevermind. i'm a derp.

U-Zyn Chua
uzyn commented

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

Andy Dawson
Collaborator
AD7six commented

@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.

Stanislav Chistenko
Wolg commented

@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?

Andy Dawson
Collaborator
AD7six commented

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.

Stanislav Chistenko Wolg closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Jul 10, 2012
Stanislav Chistenko Wolg Removing /app/tmp from gitignore c32a35a
Stanislav Chistenko Wolg Replaced the terrible empty files with pretty .gitignore files (will …
…ignore all files in a directory except themselves)
83e12a5
This page is out of date. Refresh to see the latest.
1  .gitignore
... ... @@ -1,5 +1,4 @@
1 1 /app/Config
2   -/app/tmp
3 2 /lib/Cake/Console/Templates/skel/tmp/
4 3 /plugins
5 4 /vendors
2  app/tmp/cache/models/.gitignore
... ... @@ -0,0 +1,2 @@
  1 +*
  2 +!.gitignore
0  app/tmp/cache/models/empty
No changes.
2  app/tmp/cache/persistent/.gitignore
... ... @@ -0,0 +1,2 @@
  1 +*
  2 +!.gitignore
0  app/tmp/cache/persistent/empty
No changes.
2  app/tmp/cache/views/.gitignore
... ... @@ -0,0 +1,2 @@
  1 +*
  2 +!.gitignore
0  app/tmp/cache/views/empty
No changes.
2  app/tmp/logs/.gitignore
... ... @@ -0,0 +1,2 @@
  1 +*
  2 +!.gitignore
0  app/tmp/logs/empty
No changes.
2  app/tmp/sessions/.gitignore
... ... @@ -0,0 +1,2 @@
  1 +*
  2 +!.gitignore
0  app/tmp/sessions/empty
No changes.
2  app/tmp/tests/.gitignore
... ... @@ -0,0 +1,2 @@
  1 +*
  2 +!.gitignore
0  app/tmp/tests/empty
No changes.

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.