summaryrefslogtreecommitdiff
path: root/.zsh/zshfunctions
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-10-20 15:21:39 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-10-20 15:21:40 +0200
commit9412a6a2582928cf0a4f159f1f426ef21a3b3528 (patch)
tree75e59c1bb2605623d72fba16342cd4e04f7087ca /.zsh/zshfunctions
parent7208e2ec44efab04e4fc8c3ca252fc9a11d4816a (diff)
downloaddotfiles-9412a6a2582928cf0a4f159f1f426ef21a3b3528.tar.gz
dotfiles-9412a6a2582928cf0a4f159f1f426ef21a3b3528.tar.bz2
dotfiles-9412a6a2582928cf0a4f159f1f426ef21a3b3528.zip
Modified 'cci' to honor the git staging area
Diffstat (limited to '.zsh/zshfunctions')
-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"