commands: allow $GIT_LFS_TRACK_NO_INSTALL_HOOKS to disable hook installation
This commit is contained in:
parent
5c8c8512a5
commit
df76acf33b
@ -42,7 +42,9 @@ func trackCommand(cmd *cobra.Command, args []string) {
|
||||
os.Exit(128)
|
||||
}
|
||||
|
||||
lfs.InstallHooks(false)
|
||||
if !cfg.Os.Bool("GIT_LFS_TRACK_NO_INSTALL_HOOKS", false) {
|
||||
lfs.InstallHooks(false)
|
||||
}
|
||||
|
||||
if len(args) == 0 {
|
||||
listPatterns()
|
||||
|
@ -488,3 +488,25 @@ begin_test "track (symlinked repository)"
|
||||
popd > /dev/null
|
||||
)
|
||||
end_test
|
||||
|
||||
begin_test "track (\$GIT_LFS_TRACK_NO_INSTALL_HOOKS)"
|
||||
(
|
||||
set -e
|
||||
|
||||
reponame="track-no-setup-hooks"
|
||||
git init "$reponame"
|
||||
cd "$reponame"
|
||||
|
||||
[ ! -f .git/hooks/pre-push ]
|
||||
[ ! -f .git/hooks/post-checkout ]
|
||||
[ ! -f .git/hooks/post-commit ]
|
||||
[ ! -f .git/hooks/post-merge ]
|
||||
|
||||
GIT_LFS_TRACK_NO_INSTALL_HOOKS=1 git lfs track
|
||||
|
||||
[ ! -f .git/hooks/pre-push ]
|
||||
[ ! -f .git/hooks/post-checkout ]
|
||||
[ ! -f .git/hooks/post-commit ]
|
||||
[ ! -f .git/hooks/post-merge ]
|
||||
)
|
||||
end_test
|
||||
|
Loading…
Reference in New Issue
Block a user