Bladeren bron

Move .gittum to .config/gittum

Alois Mahdal 8 maanden geleden
bovenliggende
commit
84cbb9710b

dotfiles/gittum/bin/metacm → dotfiles/config/gittum/bin/metacm Bestand weergeven

@@ -12,7 +12,7 @@ mktmpl() {
12 12
     local mtmpl_name="$1"; shift
13 13
     local mtmpl_path
14 14
     local tmpl_path
15
-    mtmpl_path="$HOME/.gittum/template/$mtmpl_name"
15
+    mtmpl_path="$HOME/.config/gittum/template/$mtmpl_name"
16 16
     test -f "$mtmpl_path" || die "no such meta-template: $mtmpl_path"
17 17
     bash -n "$mtmpl_path" || die
18 18
     tmpl_path="/.$(mktemp -t gittum-metacm.XXXXXXXX)"

dotfiles/gittum/bin/remote-edit → dotfiles/config/gittum/bin/remote-edit Bestand weergeven


+ 21
- 0
dotfiles/config/gittum/bin/setup Bestand weergeven

@@ -0,0 +1,21 @@
1
+#!/bin/bash
2
+
3
+gitver=$(git --version | cut -d ' ' -f 3)
4
+if [[ "x$gitver" > "x1.8" ]]; then
5
+    tilde='~'
6
+else
7
+    tilde=$HOME
8
+fi
9
+
10
+host=$(hostname -s)
11
+user=$(whoami)
12
+
13
+mkconfig() {
14
+    echo "[include]"
15
+    echo "    path = $tilde/.config/gittum/main.gitconfig"
16
+    echo "    path = $tilde/.config/gittum/host/$host.gitconfig"
17
+    echo "    path = $tilde/.config/gittum/user/$user.gitconfig"
18
+    echo "    path = $tilde/.config/gittum/private.gitconfig"
19
+}
20
+
21
+mkconfig >>"$HOME/.gitconfig"

dotfiles/gittum/bin/sibling → dotfiles/config/gittum/bin/sibling Bestand weergeven


dotfiles/gittum/bin/slurp → dotfiles/config/gittum/bin/slurp Bestand weergeven

@@ -24,6 +24,17 @@ allowed_slurp() {
24 24
     test -f "$ok_file"
25 25
 }
26 26
 
27
+this_branch_upstream() {
28
+    #
29
+    # Print upstream of current bvranch
30
+    #
31
+    git branch -vv \
32
+      | grep '^\*' \
33
+      | cut -d \] -f1 \
34
+      | cut -d \[ -f2 \
35
+      | cut -d :  -f1
36
+}
37
+
27 38
 allowed_push() {
28 39
     #
29 40
     # Is push allowed for the remote branch??
@@ -38,15 +49,24 @@ allowed_push() {
38 49
     #       main   aaf02f0 [main/master: ahead 25] Some other commit
39 50
     #     * master add0a03 [jdsumsion/master] Some commit
40 51
     #
41
-    local tbranch=$(
42
-        git branch -vv \
43
-          | grep '^\*' \
44
-          | cut -d \] -f1 \
45
-          | cut -d \[ -f2 \
46
-          | cut -d :  -f1
47
-    )
52
+    local tbranch
53
+    test -n "$ok_file" || return 1
54
+    tbranch=$(this_branch_upstream)
48 55
     test -n "$tbranch" || return 0
49
-    grep -qxF "PUSH $tbranch" "$ok_file" 2>/dev/null
56
+    grep -qxE "PUSH ([^ ]+ )?$tbranch" "$ok_file" 2>/dev/null
57
+}
58
+
59
+has_flag() {
60
+    #
61
+    # Has $ok_file have flag $1 for this branch?
62
+    #
63
+    local flag=$1
64
+    local tbranch
65
+    test -n "$ok_file" || return 1
66
+    tbranch=$(this_branch_upstream)
67
+    grep -xE "PUSH [^ ]+ $tbranch" "$ok_file" \
68
+     | cut -d' ' -f2 \
69
+     | grep -qwe "$flag"
50 70
 }
51 71
 
52 72
 git_relative() {
@@ -92,7 +112,11 @@ go_push() {
92 112
     #
93 113
     if $force_push || allowed_push;
94 114
     then
95
-        git push -o ci.skip
115
+        if has_flag ci; then
116
+            git push
117
+        else
118
+            git push -o ci.skip
119
+        fi
96 120
     fi
97 121
 }
98 122
 
@@ -101,9 +125,11 @@ main() {
101 125
     local ok_file
102 126
     local force_slurp=false
103 127
     local force_push=false
128
+    local skip_ci=true
104 129
     while true; do case $1 in
105 130
         --force-slurp)  force_slurp=true; shift ;;
106 131
         --force-push)   force_push=true;  shift ;;
132
+        --skip-ci)      skip_ci=true; shift ;;
107 133
         --)             shift; break ;;
108 134
         -*)             usage ;;
109 135
         *)              break ;;

dotfiles/gittum/bin/who → dotfiles/config/gittum/bin/who Bestand weergeven


dotfiles/gittum/bin/whoo → dotfiles/config/gittum/bin/whoo Bestand weergeven


dotfiles/gittum/bin/xtragc → dotfiles/config/gittum/bin/xtragc Bestand weergeven


dotfiles/gittum/disabled-commands → dotfiles/config/gittum/disabled-commands Bestand weergeven


+ 1
- 0
dotfiles/config/gittum/host/adoref.gitconfig Bestand weergeven

@@ -0,0 +1 @@
1
+../../../../../../config/dotfiles/gittum/host/adoref.gitconfig

+ 1
- 0
dotfiles/config/gittum/host/malakar.gitconfig Bestand weergeven

@@ -0,0 +1 @@
1
+../../../../../../config/dotfiles/gittum/host/malakar.gitconfig

+ 1
- 0
dotfiles/config/gittum/host/morel.gitconfig Bestand weergeven

@@ -0,0 +1 @@
1
+../../../../../../config/dotfiles/gittum/host/morel.gitconfig

+ 1
- 0
dotfiles/config/gittum/host/nauron.gitconfig Bestand weergeven

@@ -0,0 +1 @@
1
+../../../../../../config/dotfiles/gittum/host/nauron.gitconfig

+ 1
- 0
dotfiles/config/gittum/host/tamten.gitconfig Bestand weergeven

@@ -0,0 +1 @@
1
+../../../../../../config/dotfiles/gittum/host/tamten.gitconfig

+ 1
- 0
dotfiles/config/gittum/host/vagrus.gitconfig Bestand weergeven

@@ -0,0 +1 @@
1
+../../../../../../config/dotfiles/gittum/host/vagrus.gitconfig

dotfiles/gittum/main.gitconfig → dotfiles/config/gittum/main.gitconfig Bestand weergeven

@@ -11,15 +11,19 @@
11 11
   blog = log --graph --oneline --pretty=tformat:'%Cred%h%Creset - %C(yellow)%s%Creset %C(green)<%an>%Creset %C(blue)@%d%Creset' --abbrev-commit
12 12
   cm = commit --verbose
13 13
   cma = commit --verbose --amend
14
-  cmf = !~/.gittum/bin/metacm msg_flake8
15
-  cmt = !~/.gittum/bin/metacm msg_tmp
16
-  cmr = !~/.gittum/bin/metacm msg_typo
17
-  cmv = !~/.gittum/bin/metacm msg_bumpv
18
-  cmw = !~/.gittum/bin/metacm msg_wip
14
+  cme = commit --allow-empty -m 'WIP empty commit just for the kicks'
15
+  cmv = !~/.config/gittum/bin/metacm msg_bumpv
16
+  cmw = !~/.config/gittum/bin/metacm msg_wip
19 17
   co = checkout
20 18
   com = checkout master
21 19
   cp = cherry-pick
22 20
   dc = !clear && git diff --cached
21
+  dcw = !clear && git diff --cached --word-diff=color
22
+  dcp = !clear && git diff --cached --word-diff=porcelain
23
+  dcc = !clear && git diff --cached --word-diff=color --word-diff-regex=.
24
+  df = diff --word-diff=color
25
+  dfp = diff --word-diff=porcelain
26
+  dfc = diff --word-diff=color --word-diff-regex=.
23 27
   gr = log --graph --full-history --color\
24 28
        --pretty=tformat:"%x1b[31m%h%x20%x1b[32m%d%x1b[0m%x20%s%x1b[0m"
25 29
   gra = log --all --graph --full-history --color\
@@ -34,18 +38,19 @@
34 38
   rb = rebase
35 39
   rbc = rebase --continue
36 40
   rbi = rebase --interactive
37
-  rme = ! ~/.gittum/bin/remote-edit
41
+  rme = ! ~/.config/gittum/bin/remote-edit
38 42
   rmv = remote --verbose
39
-  sibling = ! ~/.gittum/bin/sibling
40
-  slurp = ! ~/.gittum/bin/slurp
43
+  sibling = ! ~/.config/gittum/bin/sibling
44
+  slurp = ! ~/.config/gittum/bin/slurp
41 45
   st = status
42 46
   sh = show
43 47
   sw = show --word-diff=color
44 48
   swp = show --word-diff=porcelain
45 49
   swc = show --word-diff=color --word-diff-regex=.
46
-  who = ! ~/.gittum/bin/who
47
-  whoo = ! ~/.gittum/bin/whoo
48
-  xtragc = ! ~/.gittum/bin/xtragc
50
+  swm = show --format="format:%B" --no-patch
51
+  who = ! ~/.config/gittum/bin/who
52
+  whoo = ! ~/.config/gittum/bin/whoo
53
+  xtragc = ! ~/.config/gittum/bin/xtragc
49 54
 
50 55
 [diff]
51 56
     guitool = kdiff3

dotfiles/gittum/template/msg_bumpv → dotfiles/config/gittum/template/msg_bumpv Bestand weergeven


dotfiles/gittum/template/msg_wip → dotfiles/config/gittum/template/msg_wip Bestand weergeven


+ 0
- 21
dotfiles/gittum/bin/setup Bestand weergeven

@@ -1,21 +0,0 @@
1
-#!/bin/bash
2
-
3
-gitver=$(git --version | cut -d ' ' -f 3)
4
-if [[ "x$gitver" > "x1.8" ]]; then
5
-    tilde='~'
6
-else
7
-    tilde=$HOME
8
-fi
9
-
10
-host=$(hostname -s)
11
-user=$(whoami)
12
-
13
-mkconfig() {
14
-    echo "[include]"
15
-    echo "    path = $tilde/.gittum/main.gitconfig"
16
-    echo "    path = $tilde/.gittum/host/$host.gitconfig"
17
-    echo "    path = $tilde/.gittum/user/$user.gitconfig"
18
-    echo "    path = $tilde/.gittum/private.gitconfig"
19
-}
20
-
21
-mkconfig >>"$HOME/.gitconfig"

+ 0
- 2
dotfiles/gittum/template/msg_flake8 Bestand weergeven

@@ -1,2 +0,0 @@
1
-#!/bin/bash
2
-echo Flake8

+ 0
- 3
dotfiles/gittum/template/msg_tmp Bestand weergeven

@@ -1,3 +0,0 @@
1
-#!/bin/bash
2
-echo ""
3
-echo "# use this file to define temporary template"

+ 0
- 2
dotfiles/gittum/template/msg_typo Bestand weergeven

@@ -1,2 +0,0 @@
1
-#!/bin/bash
2
-echo "Fix typo"