aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/completion/bash/guix24
-rwxr-xr-xetc/git/pre-push22
2 files changed, 37 insertions, 9 deletions
diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index c92f8915c9..6a5f281c4f 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU
-# Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#
@@ -26,7 +26,7 @@ _guix_complete_subcommand ()
local subcommands="$(${COMP_WORDS[0]} $command --help 2> /dev/null \
| grep '^ [a-z]' \
| sed -e's/^ \+\([a-z-]\+\).*$/\1/g')"
- COMPREPLY=($(compgen -W "$subcommands" -- "${COMP_WORDS[${#COMP_WORDS[*]} - 1]}"))
+ COMPREPLY=($(compgen -W "$subcommands" -- "${COMP_WORDS[$COMP_CWORD]}"))
}
_guix_complete_available_package ()
@@ -113,6 +113,12 @@ _guix_complete_file ()
COMPREPLY=()
}
+_guix_complete_pid ()
+{
+ local pids="$(cd /proc; echo [0-9]*)"
+ COMPREPLY=($(compgen -W "$pids" -- "$1"))
+}
+
declare _guix_subcommands
_guix_complete ()
@@ -154,11 +160,21 @@ _guix_complete ()
fi
elif _guix_is_command "system"
then
- _guix_complete_subcommand
+ case $COMP_CWORD in
+ 2) _guix_complete_subcommand;;
+ *) _guix_complete_file;; # TODO: restrict to *.scm
+ esac
+ elif _guix_is_command "container"
+ then
+ case $COMP_CWORD in
+ 2) _guix_complete_subcommand;;
+ 3) _guix_complete_pid "$word_at_point";;
+ *) _guix_complete_file;;
+ esac
elif _guix_is_command "import"
then
_guix_complete_subcommand
- elif _guix_is_command "hash"
+ elif _guix_is_command "hash" || _guix_is_command "gc"
then
_guix_complete_file
else
diff --git a/etc/git/pre-push b/etc/git/pre-push
index c894c5a9ec..9206a2dfe5 100755
--- a/etc/git/pre-push
+++ b/etc/git/pre-push
@@ -40,17 +40,29 @@ do
else
if [ "$remote_sha" = $z40 ]
then
- # New branch, examine all commits
- range="$local_sha"
+ # We are pushing a new branch. To prevent wasting too
+ # much time for this relatively rare case, we examine
+ # all commits since the first signed commit, rather than
+ # the full history. This check *will* fail, and the user
+ # will need to temporarily disable the hook to push the
+ # new branch.
+ range="e3d0fcbf7e55e8cbe8d0a1c5a24d73f341d7243b..$local_sha"
else
# Update to existing branch, examine new commits
range="$remote_sha..$local_sha"
fi
# Verify the signatures of all commits being pushed.
- git verify-commit $(git rev-list $range) >/dev/null 2>&1
-
- exit $?
+ ret=0
+ for commit in $(git rev-list $range)
+ do
+ if ! git verify-commit $commit >/dev/null 2>&1
+ then
+ printf "%s failed signature check\n" $commit
+ ret=1
+ fi
+ done
+ exit $ret
fi
done