Skip to content

Commit 68a5d9e

Browse files
authored
Merge branch 'master' into improved-shebangs
2 parents 352d330 + b46924f commit 68a5d9e

17 files changed

+46
-46
lines changed

git-all-commits

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
find .git/objects -type f | \
44
while read file; do
5-
if echo $file | egrep -q '\.idx$'; then
5+
if echo $file | grep -Eq '\.idx$'; then
66
git show-index < $file | awk '{print $2}'
7-
elif echo $file | egrep -q '[0-9a-f]{38}$'; then
7+
elif echo $file | grep -Eq '[0-9a-f]{38}$'; then
88
echo $(basename $(dirname $file))$(basename $file)
99
fi
1010
done | \

git-all-objects

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -e
33
shopt -s nullglob extglob
44

5-
cd "`git rev-parse --git-path objects`"
5+
cd "$(git rev-parse --git-path objects)"
66

77
# packed objects
88
for p in pack/pack-*([0-9a-f]).idx ; do

git-apply-url

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ if [ ! $URL ]; then
4040
error $0 URL
4141
fi
4242

43-
if [[ -x $(which curl) && $(curl -V | grep https) ]]; then
43+
if [ -x $(command -v curl) ] && [ $(curl -V | grep https) ]; then
4444
fetch="curl -s"
45-
elif [[ -x $(which wget) ]]; then
45+
elif [ -x $(command -v wget) ]; then
4646
fetch="wget -O - -q --no-check-certificate"
4747
else
4848
error need curl or wget

git-branch-done

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ else
1111
fi
1212

1313
# get current branch - typically topic branch like taskXXXX, bugXXXX, ...
14-
cb=`git rev-parse --abbrev-ref HEAD`
14+
cb=$(git rev-parse --abbrev-ref HEAD)
1515
# no fast forward merge from current branch to destination branch
1616
git checkout $DST_BRANCH && git merge --no-ff $cb && git branch -d $cb

git-changebar

+7-7
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,25 @@ $1
3737
OUT="${FILE%.tex}.diff.tex"
3838
cp "$FILE" "$OUT"
3939

40-
docstart=`grep -n 'begin{document}' "$FILE" | cut -d: -f1`
40+
docstart=$(grep -n 'begin{document}' "$FILE" | cut -d: -f1)
4141

42-
for i in `GIT_DIFF_OPTS=-u0 git diff "$REV" "$FILE" |
43-
sed -n '/^@@/s/@@ -[0-9,]* +\([0-9,]*\).*/\1/p'`
42+
for i in $(GIT_DIFF_OPTS=-u0 git diff "$REV" "$FILE" |
43+
sed -n '/^@@/s/@@ -[0-9,]* +\([0-9,]*\).*/\1/p')
4444
do
45-
start=`cut -d, -f1 <<@
45+
start=$(cut -d, -f1 <<@
4646
$i
4747
@
48-
`
48+
)
4949
if [ "$start" -gt "$docstart" ]
5050
then
5151
if grep ',' >/dev/null <<@
5252
$i
5353
@
5454
then
55-
diff=`cut -d, -f2 <<@
55+
diff=$(cut -d, -f2 <<@
5656
$i
5757
@
58-
`
58+
)
5959
else
6060
diff=0
6161
fi

git-clone.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# this script clones a repository, including all its remote branches
44
# Author: julianromera
55

6-
GIT=`which git`
6+
GIT=$(command -v git)
77

88
if [ "x$1" = "x" -o "x$2" = "x" ];then
99
echo "use: $0 <git_repository_to_clone> <directory>"
@@ -23,7 +23,7 @@ function clone {
2323

2424
$GIT pull --all
2525

26-
for remote in `$GIT branch -r | grep -v \>`; do
26+
for remote in $($GIT branch -r | grep -v \>); do
2727
$GIT branch --track ${remote#origin/} $remote;
2828
done
2929
}

git-closest-match

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ spec=$1
66
mode=${2:-diff} # num: number of lines or diff: actual diff/log message?
77
range=${3:-30} # 'all' or most recent <num> in current branch?. 'all' can be quite slow
88
if [ "$range" = 'all' ]; then
9-
all=`git rev-list --all | awk '/^commit/ {print $NF}'`
9+
all=$(git rev-list --all | awk '/^commit/ {print $NF}')
1010
else
11-
all=`git log -n $range | awk '/^commit/ {print $NF}'`
11+
all=$(git log -n $range | awk '/^commit/ {print $NF}')
1212
fi
1313

14-
commit=`for i in $all; do
14+
commit=$(for i in $all; do
1515
printf '%s\n' "$i "
1616
# why is there no git diff --shortnumstat ?
1717
git diff -M $spec $i | wc -l
18-
done | sort -k 2 -n | head -n 1 | cut -f 1 -d ' '`
18+
done | sort -k 2 -n | head -n 1 | cut -f 1 -d ' ')
1919
if [ "$mode" = diff ]; then
2020
git log --no-walk $commit | cat -
2121
git diff -M $spec $commit | cat -

git-filemerge

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
#!/bin/sh
22
if test $# = 0; then
3-
OLD=`git write-tree`
3+
OLD=$(git write-tree)
44
elif test "$1" = --cached; then
55
OLD=HEAD
6-
NEW=`git write-tree`
6+
NEW=$(git write-tree)
77
shift
88
fi
99
if test $# -gt 0; then
1010
OLD="$1"; shift
1111
fi
1212
test $# -gt 0 && test -z "$CACHED" && NEW="$1"
13-
TMPDIR1=`mktemp -d`
13+
TMPDIR1=$(mktemp -d)
1414
git archive --format=tar $OLD | (cd "$TMPDIR1"; tar xf -)
1515
if test -z "$NEW"; then
1616
TMPDIR2=$(git rev-parse --show-cdup)
1717
test -z "$cdup" && TMPDIR2=.
1818
else
19-
TMPDIR2=`mktemp -d`
19+
TMPDIR2=$(mktemp -d)
2020
git archive --format=tar $NEW | (cd "$TMPDIR2"; tar xf -)
2121
fi
2222

git-find-useful-dangling-trees

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
depth=${1:-all} # 'all' or number of depth
33

4-
for i in $(git fsck --unreachable | egrep 'tree|commit' | cut -d\ -f3)
4+
for i in $(git fsck --unreachable | grep -E 'tree|commit' | cut -d\ -f3)
55
do
66
echo -n "U:$i CM:"
77
git-closest-match $i num $depth

git-ignore-wizard

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ then
1212
exit 2
1313
fi
1414

15-
type=`echo \
15+
type=$(echo \
1616
".gitignore-root # files all developers of this repo will want to exclude, in one central location
1717
.gitignore-dirname # same, but ignore file in parent directory, so you can have multiple .gitignore files
1818
exclude # specific to it's repo, but irrelevant to other devs
1919
.gitconfig # patterns you want to ignore, independent of the repository
20-
" | dmenu | cut -d ' ' -f1`
20+
" | dmenu | cut -d ' ' -f1)
2121

2222
[ -z "$type" ] && echo 'Cancelled' && exit 0
2323

24-
dirname=` dirname $file`
25-
basename=`basename $file`
24+
dirname=$( dirname $file)
25+
basename=$(basename $file)
2626
case $type in
2727
.gitignore-root)
28-
root=`git root $file` || exit 2
28+
root=$(git root $file) || exit 2
2929
dirname=$(readlink -f $dirname)
3030
relative_dir=$(echo $dirname | sed "s#^$root##") # ie: /src
3131
echo "$relative_dir/$basename" >> $root/.gitignore
@@ -35,7 +35,7 @@ case $type in
3535
echo "$basename" >> $dirname/.gitignore
3636
;;
3737
exclude)
38-
root=`git root $file` || exit 2
38+
root=$(git root $file) || exit 2
3939
dirname=$(readlink -f $dirname)
4040
relative_dir=$(echo $dirname | sed "s#^$root##")
4141
echo "$relative_dir/$basename" >> $root/info/exclude

git-interactive-merge

100755100644
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
if [ -z "$1" -o -z "$2" ]
2+
if [ -z "$1" ] || [ -z "$2" ]
33
then
44
echo "usage: $0 <from> <to>" >&2
55
exit 2

git-merge-to

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ else
1111
fi
1212

1313
# get current branch - typically master or develop
14-
cb=`git rev-parse --abbrev-ref HEAD`
14+
cb=$(git rev-parse --abbrev-ref HEAD)
1515
# no fast forward merge from current branch to destination branch
1616
git checkout $DST_BRANCH && git merge --ff $cb && git co $cb

git-release

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ else
1111
fi
1212

1313
# get current branch - typically master or develop
14-
cb=`git rev-parse --abbrev-ref HEAD`
14+
cb=$(git rev-parse --abbrev-ref HEAD)
1515
# push current branch, pull destination branch, fast forward merge from current branch to destination branch, push and return
1616
git push && git checkout $DST_BRANCH && git pull && git merge --ff $cb && git push && git checkout $cb

git-remote-in-sync.sh

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
# written by Dieter Plaetinck
1414

1515
list="$@"
16-
[ -z "$list" ] && list=`git remote`
16+
[ -z "$list" ] && list=$(git remote)
1717
ret=0
1818

19-
if [ -z "`git branch`" ]
19+
if [ -z "$(git branch)" ]
2020
then
2121
if [ $(cd "$(git root)" && ls -Al | egrep -v "^(.git|total)" | wc -l) -gt 0 ]
2222
then
@@ -42,7 +42,7 @@ else
4242
if [ -n "$@" ]
4343
then
4444
echo "INFO: working with remote(s): $@"
45-
echo "INFO: fyi, all remotes: "`git remote`
45+
echo "INFO: fyi, all remotes: "$(git remote)
4646
else
4747
echo "INFO: working with all remotes: $list"
4848
fi
@@ -64,7 +64,7 @@ do
6464
fi
6565
IFS_BACKUP=$IFS
6666
IFS=$'\n'
67-
for branch in `git branch`
67+
for branch in $(git branch)
6868
do
6969
branch=${branch/\*/};
7070
branch_local=${branch// /}; # git branch prefixes branches with spaces. and spaces in branchnames are illegal.
@@ -86,27 +86,27 @@ do
8686
IFS=$IFS_BACKUP
8787

8888
# Check tags
89-
out=`git push --tags -n $remote 2>&1`
89+
out=$(git push --tags -n $remote 2>&1)
9090
if [ "$out" != 'Everything up-to-date' ];
9191
then
9292
echo -e " WARN: Some tags are not in $remote!\n$out" >&2
9393
ret=1
9494
else
95-
echo " INFO: All tags ("`git tag`") exist at $remote as well"
95+
echo " INFO: All tags ("$(git tag)") exist at $remote as well"
9696
fi
9797
done
9898

9999
# Check WC/index
100-
cur_branch=`git branch | grep '^\* ' | cut -d ' ' -f2`
100+
cur_branch=$(git branch | grep '^\* ' | cut -d ' ' -f2)
101101
cur_branch=${cur_branch// /}
102102
exp="# On branch $cur_branch
103103
nothing to commit (working directory clean)"
104-
out=`git status`
104+
out=$(git status)
105105
wc_ok=1
106106
if [ "$out" != "$exp" ]
107107
then
108108
# usually i'd use bash regex, but this case is multiple-lines so bash regex is no go
109-
out=$(echo "$out" | egrep -v "^(# On branch $cur_branch|# Your branch is behind .* commits, and can be fast-forwarded.|#|nothing to commit \(working directory clean\))$")
109+
out=$(echo "$out" | grep -E -v "^(# On branch $cur_branch|# Your branch is behind .* commits, and can be fast-forwarded.|#|nothing to commit \(working directory clean\))$")
110110
if [ -n "$out" ]
111111
then
112112
wc_ok=0
@@ -122,7 +122,7 @@ then
122122
fi
123123

124124
# Check stash
125-
if [ `git stash list | wc -l` -gt 0 ];
125+
if [ $(git stash list | wc -l) -gt 0 ];
126126
then
127127
echo "WARN: Dirty stash:" >&2
128128
GIT_PAGER= git stash list >&2

git-root

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ then
99
then
1010
cd "$1"
1111
else
12-
cd "`dirname $1`"
12+
cd "$(dirname "$1")"
1313
fi
1414
fi
1515
exec git rev-parse --show-toplevel

git-standup

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fi
3636
# which may fail on systems lacking tput or terminfo
3737
set -e
3838

39-
AUTHOR=${1:-"`git config user.name`"}
39+
AUTHOR=${1:-"$(git config user.name)"}
4040

4141
WEEKSTART="$( cut -d '-' -f 1 <<< "$2" )";
4242
WEEKSTART=${WEEKSTART:="Mon"}

git-write-stream-info

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ else
3030
to=$2
3131
fi
3232

33-
file_name=`echo $from | sed 's/\//_/g'`--`echo $to | sed 's/\//_/g'`---$date
33+
file_name=$(echo $from | sed 's/\//_/g'`--`echo $to | sed 's/\//_/g')---$date
3434
file=$where/$file_name
3535
last=$where/last
3636

0 commit comments

Comments
 (0)