Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master guru-tools by Bor Kraljič (8e62460e9b1b9a9373fe79ac417b3b4e55887f25)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Bor Kraljič <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master guru-tools by Bor Kraljič (8e62460e9b1b9a9373fe79ac417b3b4e55887f25)
  • Date: Thu, 22 Sep 2011 08:26:26 -0500

GIT changes to master guru-tools by Bor Kraljič <pyrobor AT ver.si>:

smgl-keyring-diff | 45 ++++++++++++++++++++++++++++++---------------
1 files changed, 30 insertions(+), 15 deletions(-)

New commits:
commit 8e62460e9b1b9a9373fe79ac417b3b4e55887f25
Author: Bor Kraljič <pyrobor AT ver.si>
Commit: Bor Kraljič <pyrobor AT ver.si>

smgl-keyring-diff: added check that we are in git repository

commit 4a32c921ae9d86f3d669581a1793af5b51f4dde9
Author: Bor Kraljič <pyrobor AT ver.si>
Commit: Bor Kraljič <pyrobor AT ver.si>

smgl-keyring-diff: added check if file used is gnupg-keyring

Otherwise print usage and quit.

commit 2b9a4855b2358abe37fbd78964960bf73beac37d
Author: Bor Kraljič <pyrobor AT ver.si>
Commit: Bor Kraljič <pyrobor AT ver.si>

smgl-keyring-diff: added function to print usage.

Also added that usage is printed if --help or -h is used.

diff --git a/smgl-keyring-diff b/smgl-keyring-diff
index 433d9c9..d4847ba 100755
--- a/smgl-keyring-diff
+++ b/smgl-keyring-diff
@@ -1,22 +1,37 @@
#!/bin/bash

-if [ -z $1 ]; then
- echo
- echo $(basename $0) shows changes to the gpg keyring in git repository
- echo
- echo To show the last change to the gurus.gpg run:
- echo $(basename $0) gurus.gpg
- echo
- echo To show change No. 1 run:
- echo $(basename $0) gurus.gpg 1
- echo
- echo It also works with negative numbers. For example
- echo to show preprevious change run:
- echo $(basename $0) gurus.gpg -2
- echo
- exit 1
+function show_usage() {
+ exit_code=${1:-1}
+ usage="$(basename $0) shows changes to the gpg keyring in git repository
+
+To show the last change to the gurus.gpg run:
+$(basename $0) gurus.gpg
+
+To show change No. 1 run:
+$(basename $0) gurus.gpg 1
+
+It also works with negative numbers. For example
+to show preprevious change run:
+$(basename $0) gurus.gpg -2"
+ echo -e "$usage"
+ exit $exit_code
+}
+
+if [ -z $1 ] || [[ $1 =~ (--help|-h) ]]; then
+ show_usage
fi

+if ! file -bi "$1" | grep -iq gnupg-keyring ; then
+ echo "File $1 is not valid gpg keyring!"
+ show_usage 3
+fi
+
+if [[ $(git rev-parse --is-inside-work-tree) != "true" ]]; then
+ echo "You must be inside git repository"
+ show_usage 5
+fi
+
+
working_branch=$(git branch |grep \* |cut -d" " -f2)
# lets do all the git work in a branch
git checkout -q -b $(basename $0)-temp



  • [SM-Commit] GIT changes to master guru-tools by Bor Kraljič (8e62460e9b1b9a9373fe79ac417b3b4e55887f25), Bor Kraljič, 09/22/2011

Archive powered by MHonArc 2.6.24.

Top of Page