summaryrefslogtreecommitdiffstats
path: root/bashrc/main.sh
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-05-12 23:58:08 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2012-05-12 23:58:08 +0200
commit4c3a070eefded48a4828423095362b691cb1a8f4 (patch)
tree3adeba5ec98eaf858ec9aa2ad2d2e74518ce15f9 /bashrc/main.sh
parent651572c8d07ec48287723073e98daed75046ba31 (diff)
downloaddotfiles-4c3a070eefded48a4828423095362b691cb1a8f4.tar.gz
dotfiles-4c3a070eefded48a4828423095362b691cb1a8f4.tar.xz
dotfiles-4c3a070eefded48a4828423095362b691cb1a8f4.zip
bashrc/main: use tag instead of branch to track old origin
use tag to track the base of the current "rebase" and update tag before cherry-pick and stash to be the real base
Diffstat (limited to 'bashrc/main.sh')
-rw-r--r--bashrc/main.sh18
1 files changed, 11 insertions, 7 deletions
diff --git a/bashrc/main.sh b/bashrc/main.sh
index 5ed9b15..0552035 100644
--- a/bashrc/main.sh
+++ b/bashrc/main.sh
@@ -17,9 +17,13 @@ _self_update() {
pushd ${_DOTFILES_DIR} &>/dev/null
# save the origin, the current master is based of
- if ! git branch | grep old-origin -q; then
- git branch --no-track old-origin origin/master >/dev/null 2>&1
- fi
+ if ! git tag | grep old-origin -q; then
+ if git branch | grep old-origin -q; then
+ git branch -D old-origin >/dev/null 2>&1
+ fi
+
+ git tag old-origin origin/master >/dev/null 2>&1
+ fi
if hash timeout >/dev/null 2>&1; then
timeout 3s git fetch origin 2>/dev/null
@@ -52,6 +56,10 @@ _self_update() {
git reset --hard origin/master >/dev/null
+ # update old-origin
+ git tag -d old-origin >/dev/null 2>&1
+ git tag old-origin origin-master >/dev/null 2>&1
+
if [[ -n "$_local_commits" ]]; then
echo -e "\033[33m*\033[0m cherry-pick: $_local_commits"
git cherry-pick $_local_commits >/dev/null || return
@@ -61,10 +69,6 @@ _self_update() {
git stash pop >/dev/null || return
fi
- # all done, update old-origin
- git branch -D old-origin >/dev/null 2>&1
- git branch --no-track old-origin origin/master >/dev/null 2>&1
-
if [[ -e management/symlinks.md5 ]]; then
if hash md5sum 2> /dev/null ; then
md5sum -c management/symlinks.md5 --status 2>/dev/null