GitXplorerGitXplorer
n

UnityGitHooks

public
13 stars
4 forks
0 issues

Commits

List of commits on branch master.
Verified
7b42a7b6b5ee7476254a99274be2067e21ea0e9b

Add environment in README

nnetworm committed 6 years ago
Verified
463c924b697742bef34165fc557d0f5b172ffff6

Add useless files in README

nnetworm committed 6 years ago
Verified
17a5a24f67a581f5bdc5cf82a1fd173e9ad9a10a

Remove useless files first

nnetworm committed 6 years ago
Unverified
bfc6c9bf92e6fc924ba53bb08a3b4322fae98d74

Add test in README

nnetworm committed 9 years ago
Unverified
a1a969daa1e5015a53702a777b407b318bd80adc

Add testcase

nnetworm committed 9 years ago
Unverified
85f2f28331ed9e441147f71bbb219e5821667029

Add post-checkout and post-merge hooks

nnetworm committed 9 years ago

README

The README file for this repository.

Unity Git hooks

Git won't tracked directory changes so you need remove them yourself after checkout. Unity would generate .meta file for every file and directory. So these hooks use to remove empty directory and its .meta file for consistency.

Environment

  • Git for Windows
  • Git on macOS

Usage

Just copy install-hooks.sh and hooks directory to your git repository, then run install-hooks.sh.

Notes

  • file mode

    hooks/post-checkout and hooks/post-merge don't set executable attribute but set when run install-hooks.sh. It's because of Git for Windows. Git for Windows doesn't set core.filemode to true. So every file is always 644.

  • depth first

    When find empty directories, we need find to perform depth-first traversal. And we need delete every empty directory when encountered. So that we could remove nested empty directories.

  • useless files

    There are too many useless files exist in working dir, include .DS_Store, Thumbs.db, Desktop.ini, desktop.ini. They are generated occasionally by Operating System. These files are usually ignored in .gitignore file. Then Git treat containing directory didn't exist but Unity don't think so. Unity would generate corresponding .meta for directory. We need delete these useless ignored files.

Test

You could run hooks/testcase.sh to build test directory structure. And then you could run hooks/post-checkout.sh or hooks/post-merge to remove empty directories.

Reference