summaryrefslogtreecommitdiff
path: root/.zsh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.zsh/zshfunctions39
1 files changed, 29 insertions, 10 deletions
diff --git a/.zsh/zshfunctions b/.zsh/zshfunctions
index 72e455d..a83cbd8 100644
--- a/.zsh/zshfunctions
+++ b/.zsh/zshfunctions
@@ -32,6 +32,17 @@ open_ebuild ()
# Works only for simple cases
cci ()
{
+ ask ()
+ {
+ echo -n "Is this ok? [y/n] "
+
+ if ! read -q; then
+ echo
+ echo "I would have done the wrong thing ... aborting!"
+ return 2
+ fi
+ }
+
if [[ $# == 0 ]]; then
echo "No message given. Aborting."
return 1
@@ -39,23 +50,31 @@ cci ()
local message=$1
local tok=__cci__
-
+
pushd -q ~
- cstg diff
- echo -n "Is this ok? [y/n] "
-
- if ! read -q; then
- echo
- echo "I would have done the wrong thing ... aborting!"
- return 2
+ local indexed="$(config status --porcelain | grep -v '^ ')"
+
+ if [[ -n $indexed ]]; then
+ echo ">> Stuff in index -- only commiting this"
+ echo "$indexed"
+ ask || return 2
+ else
+ echo ">> Nothing in index -- commiting everything which has changed"
+ echo "$(config status)"
+
+ ask || return 2
+ config add -u
fi
+ cstg diff -O --cached
+ ask || return 2
+
echo ">> Creating new patch"
cstg new $tok -m "$message"
echo ">> Refreshing"
- cstg refresh
+ cstg refresh -i
if [[ -z $(cstg files) ]]; then
echo
@@ -79,7 +98,7 @@ cci ()
config push
echo ">> Re-apply patches"
- cstg push -a
+ cstg push -a -k
echo ">> Done"