Skip to content

Commit 3a47e9a

Browse files
committed
Update git scripts
Update git scripts Signed-off-by: Bensuperpc <[email protected]>
1 parent 070caca commit 3a47e9a

File tree

4 files changed

+37
-18
lines changed

4 files changed

+37
-18
lines changed

git/git-apply-patch.sh

100644100755
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ set -euo pipefail
1919
#// CPU: ALL //
2020
#// //
2121
#//////////////////////////////////////////////////////////////
22-
23-
for var in "$@"
24-
do
25-
git apply --stat $var
26-
git apply --check $var
27-
git am --signoff < $var
28-
done
22+
if (( $# >= 1 )); then
23+
for var in "$@"
24+
do
25+
git apply --stat $var
26+
git apply --check $var
27+
git am --signoff < $var
28+
done
29+
else
30+
echo "Usage: ${0##*/} <patch 1> <patch 2>..."
31+
exit 1
32+
fi

git/git-clone-all.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -euo pipefail
1111
#// //
1212
#// Script, 2021 //
1313
#// Created: 23, July, 2021 //
14-
#// Modified: 24, July, 2021 //
14+
#// Modified: 25, July, 2021 //
1515
#// file: - //
1616
#// - //
1717
#// Source: //
@@ -20,7 +20,12 @@ set -euo pipefail
2020
#// //
2121
#//////////////////////////////////////////////////////////////
2222

23-
for var in "$@"
24-
do
25-
git clone --recurse-submodules --remote-submodules --progress --jobs=$(nproc) $var
26-
done
23+
if (( $# >= 1 )); then
24+
for var in "$@"
25+
do
26+
git clone --recurse-submodules --remote-submodules --progress --jobs=$(nproc) $var
27+
done
28+
else
29+
echo "Usage: ${0##*/} <repo URL 1> <repo URL 2>..."
30+
exit 1
31+
fi

git/git-commit.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -euo pipefail
1111
#// //
1212
#// Script, 2021 //
1313
#// Created: 24, July, 2021 //
14-
#// Modified: 24, July, 2021 //
14+
#// Modified: 25, July, 2021 //
1515
#// file: - //
1616
#// - //
1717
#// Source: https://stackoverflow.com/a/2979587/10152334 //
@@ -21,10 +21,10 @@ set -euo pipefail
2121
#//////////////////////////////////////////////////////////////
2222

2323
if (( $# == 2 )); then
24-
git commit -s -m "$1" -m "$2"
24+
git commit -s -m "$1" -m "$2"
2525
elif (( $# == 1 )); then
2626
echo $1
27-
git commit -s -m "$1" -m "$1"
27+
git commit -s -m "$1" -m "$1"
2828
else
2929
echo "Usage: ${0##*/} <Title> <Message>"
3030
echo "Usage: ${0##*/} <Title>"

git/git-create-patch.sh

100644100755
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -euo pipefail
1111
#// //
1212
#// Script, 2021 //
1313
#// Created: 21, June, 2021 //
14-
#// Modified: 24, July, 2021 //
14+
#// Modified: 25, July, 2021 //
1515
#// file: - //
1616
#// - //
1717
#// Source: //
@@ -20,5 +20,15 @@ set -euo pipefail
2020
#// //
2121
#//////////////////////////////////////////////////////////////
2222

23-
git format-patch -n HEAD^
24-
#git format-patch cc1dde0dd^..6de6d4b06 --stdout > foo.patch
23+
if (( $# == 0 )); then
24+
git format-patch -n HEAD^
25+
elif (( $# == 1 )); then
26+
git format-patch HEAD~$1..HEAD --stdout > last-$1-commit.patch
27+
elif (( $# == 2 )); then
28+
git diff "$1" "$2" -- > $1-$2.patch
29+
else
30+
echo "Usage: ${0##*/} (patch HEAD)"
31+
echo "Usage: ${0##*/} <nbr from HEAD>"
32+
echo "Usage: ${0##*/} <tag or hash 1> <tag or hash 2>"
33+
exit 1
34+
fi

0 commit comments

Comments
 (0)