-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprimerc
More file actions
79 lines (64 loc) · 2.53 KB
/
Copy pathprimerc
File metadata and controls
79 lines (64 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
function git() {
# 如果第一个参数是 push,则进入自定义逻辑
if [ "$1" = "push" ]; then
# 获取远程仓库 URL
local remote_name="${2:-origin}"
local remote_url=$(command git remote get-url "$remote_name" 2>/dev/null)
# 判断是否为特定的 Gerrit 域名
if [[ "$remote_url" == *"gerrit.uniontech.com"* ]]; then
echo "--- 检测到 Gerrit 仓库,执行自动修正与评审推送 ---"
# 1. 修正身份信息(仅限当前仓库)
if [ "$(command git config user.email)" != "liuzhiyuan@uniontech.com" ]; then
command git config user.email "liuzhiyuan@uniontech.com"
command git commit --amend --no-edit --reset-author
fi
# 2. 推送至 refs/for/
local branch="${3:-$(command git rev-parse --abbrev-ref HEAD)}"
shift $(( $# < 3 ? $# : 3 ))
command git push "${remote_name}" "${branch}:refs/for/${branch}" "$@"
else
# 普通仓库,执行原生的 git push
shift 1
command git push "$@"
fi
else
# 非 push 命令,直接透传
command git "$@"
fi
}
alias prime-apt='/home/prime/prime-apt/bin/prime-apt'
# quilt
if type quilt >/dev/null 2>&1; then
if [ ! -e "$HOME/.quiltrc" ]; then
echo '
d=. ; while [ ! -d $d/debian -a $(readlink -e $d) != / ]; do d=$d/..; done
if [ -d $d/debian ] && [ -z $QUILT_PATCHES ]; then
# if in Debian packaging tree with unset $QUILT_PATCHES
QUILT_PATCHES="debian/patches"
QUILT_PATCH_OPTS="--reject-format=unified"
QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"
QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33"
if ! [ -d $d/debian/patches ]; then mkdir $d/debian/patches; fi
fi
' > "$HOME/.quiltrc"
fi
# alias quilt='quilt --quiltrc="$HOME/.quiltrc"'
fi
# diffiso
export DIFFISO_AS_ROOT=true
# dch
export DEBFULLNAME=liuzhiyuan
export DEBEMAIL=liuzhiyuan@uniontech.com
## nvm npm
export NVM_DIR="$HOME/.config/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
## prime-apt
alias prime-apt="$HOME/prime-apt/bin/prime-apt"
go_path="$HOME/.local/go/bin"
if [ -d "$go_path" ]; then
export PATH="$go_path:$PATH"
fi
## opencode completion
source <(opencode completion 2>/dev/null)