Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
cb60cfc7
Commit
cb60cfc7
authored
Sep 20, 2016
by
Ariel Rivas
Committed by
Robby Russell
Sep 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid unnecesary processing... (#5352)
by discarding directories or files with permissions already correctly set
parent
63d300ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
perms.plugin.zsh
plugins/perms/perms.plugin.zsh
+6
-6
No files found.
plugins/perms/perms.plugin.zsh
View file @
cb60cfc7
...
@@ -6,10 +6,10 @@
...
@@ -6,10 +6,10 @@
### Aliases
### Aliases
# Set all files' permissions to 644 recursively in a directory
# Set all files' permissions to 644 recursively in a directory
alias
set644
=
'find . -type f -print0 | xargs -0 chmod 644'
alias
set644
=
'find . -type f
! -perm 644
-print0 | xargs -0 chmod 644'
# Set all directories' permissions to 755 recursively in a directory
# Set all directories' permissions to 755 recursively in a directory
alias
set755
=
'find . -type d -print0 | xargs -0 chmod 755'
alias
set755
=
'find . -type d
! -perm 755
-print0 | xargs -0 chmod 755'
### Functions
### Functions
...
@@ -63,14 +63,14 @@ EOF
...
@@ -63,14 +63,14 @@ EOF
exit_status
=
0
;
exit_status
=
0
;
if
[[
$use_slow
==
true
]]
;
then
if
[[
$use_slow
==
true
]]
;
then
# Process directories first so non-traversable ones are fixed as we go
# Process directories first so non-traversable ones are fixed as we go
find
"
$target
"
-type
d
-exec
chmod
$chmod_opts
755
{}
\;
find
"
$target
"
-type
d
!
-perm
755
-exec
chmod
$chmod_opts
755
{}
\;
if
[[
$?
!=
0
]]
;
then
exit_status
=
$?
;
fi
if
[[
$?
!=
0
]]
;
then
exit_status
=
$?
;
fi
find
"
$target
"
-type
f
-exec
chmod
$chmod_opts
644
{}
\;
find
"
$target
"
-type
f
!
-perm
644
-exec
chmod
$chmod_opts
644
{}
\;
if
[[
$?
!=
0
]]
;
then
exit_status
=
$?
;
fi
if
[[
$?
!=
0
]]
;
then
exit_status
=
$?
;
fi
else
else
find
"
$target
"
-type
d
-print0
| xargs
-0
chmod
$chmod_opts
755
find
"
$target
"
-type
d
!
-perm
755
-print0
| xargs
-0
chmod
$chmod_opts
755
if
[[
$?
!=
0
]]
;
then
exit_status
=
$?
;
fi
if
[[
$?
!=
0
]]
;
then
exit_status
=
$?
;
fi
find
"
$target
"
-type
f
-print0
| xargs
-0
chmod
$chmod_opts
644
find
"
$target
"
-type
f
!
-perm
644
-print0
| xargs
-0
chmod
$chmod_opts
644
if
[[
$?
!=
0
]]
;
then
exit_status
=
$?
;
fi
if
[[
$?
!=
0
]]
;
then
exit_status
=
$?
;
fi
fi
fi
echo
"Complete"
echo
"Complete"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment