aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/%HOME%/.bash_utils/git.sh
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-06-01 07:03:37 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2017-06-01 07:03:37 +0300
commited045b9d7e007508cbf6f6fb0650e69a050fb0db (patch)
treee812c3311bd857a8a302898238c165de8076a738 /%HOME%/.bash_utils/git.sh
parent.gitconfig: log.follow = true (diff)
downloadlinux-home-ed045b9d7e007508cbf6f6fb0650e69a050fb0db.tar.gz
linux-home-ed045b9d7e007508cbf6f6fb0650e69a050fb0db.zip
git.sh: refactoring
Rename functions to better reflect their scopes. Like, whether a routine applies to a branch or to a whole repository.
Diffstat (limited to '')
-rw-r--r--%HOME%/.bash_utils/git.sh38
1 files changed, 19 insertions, 19 deletions
diff --git a/%HOME%/.bash_utils/git.sh b/%HOME%/.bash_utils/git.sh
index 9f829e2..361d16e 100644
--- a/%HOME%/.bash_utils/git.sh
+++ b/%HOME%/.bash_utils/git.sh
@@ -7,26 +7,26 @@
source "$HOME/.bash_utils/text.sh"
-alias repo_files='git ls-tree -r --name-only HEAD'
-alias repo_dirs='git ls-tree -r --name-only HEAD -d'
+alias branch_files='git ls-tree -r --name-only HEAD'
+alias branch_dirs='git ls-tree -r --name-only HEAD -d'
repo_branches() {
git for-each-ref --format='%(refname:short)' refs/heads/
}
-repo_is_clean() (
+workdir_is_clean() (
set -o errexit -o nounset -o pipefail
test -z "$( git status --porcelain )"
)
-alias repo_clean_all='git clean -fdx'
-alias repo_clean_ignored='git clean -fdX'
+alias workdir_clean_all='git clean -fdx'
+alias workdir_clean_ignored='git clean -fdX'
branch_eol_normalized() (
set -o errexit -o nounset -o pipefail
- if repo_is_clean; then
- repo_clean_ignored
+ if workdir_is_clean; then
+ workdir_clean_ignored
else
echo "${FUNCNAME[0]}: repository isn't clean" >&2
return 1
@@ -65,8 +65,8 @@ branch_eol_normalized() (
repo_eol_normalized() (
set -o errexit -o nounset -o pipefail
- if repo_is_clean; then
- repo_clean_ignored
+ if workdir_is_clean; then
+ workdir_clean_ignored
else
echo "${FUNCNAME[0]}: repository isn't clean" >&2
return 1
@@ -79,15 +79,15 @@ repo_eol_normalized() (
done < <( repo_branches )
)
-repo_tighten_permissions() (
+workdir_tighten_permissions() (
set -o errexit -o nounset -o pipefail
- repo_files -z | xargs -0 -- chmod 0600 --
- repo_dirs -z | xargs -0 -- chmod 0700 --
+ branch_files -z | xargs -0 -- chmod 0600 --
+ branch_dirs -z | xargs -0 -- chmod 0700 --
chmod 0700 .git
)
-repo_doslint() (
+branch_doslint() (
set -o errexit -o nounset -o pipefail
local -a paths
@@ -95,12 +95,12 @@ repo_doslint() (
while IFS= read -d '' -r path; do
paths+=("$path")
- done < <( repo_files -z )
+ done < <( branch_files -z )
doslint ${paths[@]+"${paths[@]}"}
)
-repo_lint() (
+branch_lint() (
set -o errexit -o nounset -o pipefail
local -a paths
@@ -108,12 +108,12 @@ repo_lint() (
while IFS= read -d '' -r path; do
paths+=("$path")
- done < <( repo_files -z )
+ done < <( branch_files -z )
lint ${paths[@]+"${paths[@]}"}
)
-repo_backup() (
+branch_backup() (
set -o errexit -o nounset -o pipefail
local repo_dir
@@ -139,8 +139,8 @@ repo_backup() (
HEAD
)
-repo_backup_dropbox() (
+branch_backup_dropbox() (
set -o errexit -o nounset -o pipefail
- repo_backup "$USERPROFILE/Dropbox/backups"
+ branch_backup "$USERPROFILE/Dropbox/backups"
)