From 9412a6a2582928cf0a4f159f1f426ef21a3b3528 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Wed, 20 Oct 2010 15:21:39 +0200 Subject: Modified 'cci' to honor the git staging area --- .zsh/zshfunctions | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to '.zsh/zshfunctions') 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" -- cgit v1.2.3-54-g00ecf