Package: git-extras
Version: 1.9.0-1
Severity: wishlist
Tags: patch
Thanks for packaging.
1. there are a few scripts that don't need the bash-shebang line;
`checkbashisms' don't report any:
- /usr/bin/git-effort
- /usr/bin/git-pull-request
or can be very easily be unbashified
2. the scripts can be improved; mainly, using shell builtins instead of
forking external applications; see attached patch proposals; I'm prepared
to put in some more effort into it, if you're interested
3. there would be nice if zsh-completion was also provided; there are some
efforts to do so; see:
https://github.com/visionmedia/git-extras/issues/70
https://github.com/robbyrussell/oh-my-zsh
https://github.com/tlvince/git-extras/blob/zsh-completion/etc/zsh_completion.zsh
-- System Information:
Debian Release: jessie/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.11-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Versions of packages git-extras depends on:
ii git 1:1.8.5.2-1
git-extras recommends no packages.
git-extras suggests no packages.
-- no debconf information
Cheers,
--
Cristian
From 385e36948bd57ceb43c03755e32e991ca3f0bdc8 Mon Sep 17 00:00:00 2001
From: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
Date: Thu, 26 Dec 2013 15:19:10 +0100
Subject: [PATCH 1/9] The `colrm' fork isn't needed if `sed' is used anyway.
`colrm' belongs to package bsdmainutils (on debian) and using that creates
an unnecessary dependency too.
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
---
bin/git-alias | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/git-alias b/bin/git-alias
index f3814d6..8a0c18c 100755
--- a/bin/git-alias
+++ b/bin/git-alias
@@ -1,7 +1,7 @@
#!/bin/sh
case $# in
- 0) git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' | sort ;;
+ 0) git config --get-regexp 'alias.*' | sed 's/^alias\.\([^[:blank:]]\+\)[[:blank:]]\+\(.*\)$/\1 = \2/' | sort ;;
1) git alias | grep -e "$1" ;;
*) git config --global "alias.$1" "$2" ;;
esac
--
1.8.5.2
From 1b4625597f9cadbc94a5a4a872ce373aa3c60840 Mon Sep 17 00:00:00 2001
From: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
Date: Thu, 26 Dec 2013 15:31:59 +0100
Subject: [PATCH 2/9] Be exact on matching aliases only.
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
---
bin/git-alias | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/git-alias b/bin/git-alias
index 8a0c18c..e8720ff 100755
--- a/bin/git-alias
+++ b/bin/git-alias
@@ -2,6 +2,6 @@
case $# in
0) git config --get-regexp 'alias.*' | sed 's/^alias\.\([^[:blank:]]\+\)[[:blank:]]\+\(.*\)$/\1 = \2/' | sort ;;
- 1) git alias | grep -e "$1" ;;
+ 1) git alias | grep -e "^[^[:blank:]]*$1[^[:blank:]]*[[:blank:]]\+=" ;;
*) git config --global "alias.$1" "$2" ;;
esac
--
1.8.5.2
From 116ed1a2b4bdbde7de801d793ac197c5f769e204 Mon Sep 17 00:00:00 2001
From: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
Date: Thu, 26 Dec 2013 17:22:00 +0100
Subject: [PATCH 3/9] Simplify; no extra forks; use shell builtins.
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
---
bin/git-back | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/bin/git-back b/bin/git-back
index e4f73ca..d4cc185 100755
--- a/bin/git-back
+++ b/bin/git-back
@@ -1,11 +1,10 @@
#!/bin/sh
-if test $# -eq 0; then
- git reset --soft HEAD~1
-else
- if `echo $1 | grep -q [^[:digit:]]`; then
- echo "$1 is not a number" 1>&2
- else
- git reset --soft HEAD~$1
- fi
-fi
+n=${1:-1}
+case $n in
+ *[![:digit:]]*)
+ echo "$n is not a number" >&2
+ exit 1
+ ;;
+esac
+git reset --soft HEAD~$n
--
1.8.5.2
From d3ce8e34b50546a4f9a37fddc9e98ace4387502a Mon Sep 17 00:00:00 2001
From: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
Date: Thu, 26 Dec 2013 18:37:10 +0100
Subject: [PATCH 4/9] Remove useless quotes.
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
---
bin/git-bug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/git-bug b/bin/git-bug
index 4ce5437..6bd0b04 100755
--- a/bin/git-bug
+++ b/bin/git-bug
@@ -1,6 +1,6 @@
#!/bin/sh
-if test "$1" = "finish"; then
+if test "$1" = finish; then
test -z $2 && echo "bug <name> required." 1>&2 && exit 1
branch=bug/$2
git merge --no-ff $branch && git delete-branch $branch
--
1.8.5.2
From 55c9e1bfa5df3bd5f03c0649fe2f736701b9c42a Mon Sep 17 00:00:00 2001
From: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
Date: Thu, 26 Dec 2013 18:39:46 +0100
Subject: [PATCH 5/9] Use safer inverted logic.
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
---
bin/git-bug | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/bin/git-bug b/bin/git-bug
index 6bd0b04..cb6c7d1 100755
--- a/bin/git-bug
+++ b/bin/git-bug
@@ -1,11 +1,17 @@
#!/bin/sh
if test "$1" = finish; then
- test -z $2 && echo "bug <name> required." 1>&2 && exit 1
+ test $2 || {
+ echo "bug <name> required." 1>&2
+ exit 1
+ }
branch=bug/$2
git merge --no-ff $branch && git delete-branch $branch
else
- test -z $1 && echo "bug <name> required." && exit 1
+ test $1 || {
+ echo "bug <name> required."
+ exit 1
+ }
branch=bug/$1
git checkout -b $branch &> /dev/null
fi
--
1.8.5.2
From db26f6ddef423f9914ec731a0ec2852bcc7fb8dc Mon Sep 17 00:00:00 2001
From: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
Date: Thu, 26 Dec 2013 18:40:39 +0100
Subject: [PATCH 6/9] Remove default stdout file reference.
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
---
bin/git-bug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/git-bug b/bin/git-bug
index cb6c7d1..769005f 100755
--- a/bin/git-bug
+++ b/bin/git-bug
@@ -2,7 +2,7 @@
if test "$1" = finish; then
test $2 || {
- echo "bug <name> required." 1>&2
+ echo "bug <name> required." >&2
exit 1
}
branch=bug/$2
--
1.8.5.2
From b249b22209abecf737398756c490239a83c263d1 Mon Sep 17 00:00:00 2001
From: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
Date: Thu, 26 Dec 2013 18:43:55 +0100
Subject: [PATCH 7/9] Errors go to stderr.
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
---
bin/git-bug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/git-bug b/bin/git-bug
index 769005f..581bb9f 100755
--- a/bin/git-bug
+++ b/bin/git-bug
@@ -9,7 +9,7 @@ if test "$1" = finish; then
git merge --no-ff $branch && git delete-branch $branch
else
test $1 || {
- echo "bug <name> required."
+ echo "bug <name> required." >&2
exit 1
}
branch=bug/$1
--
1.8.5.2
From b10620aa886b76806258dee0f359208055a08b86 Mon Sep 17 00:00:00 2001
From: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
Date: Thu, 26 Dec 2013 18:45:45 +0100
Subject: [PATCH 8/9] Unbashify.
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbo...@axis.com>
---
bin/git-bug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/git-bug b/bin/git-bug
index 581bb9f..d00c712 100755
--- a/bin/git-bug
+++ b/bin/git-bug
@@ -13,5 +13,5 @@ else
exit 1
}
branch=bug/$1
- git checkout -b $branch &> /dev/null
+ git checkout -b $branch >/dev/null 2>&1
fi
--
1.8.5.2