blob: de066e2280573d469639e920d82392880a10c35c (
plain) (
blame)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
{
config,
lib,
pkgs,
...
}:
let
inherit (config) userinfo;
in
{
home.packages = with pkgs; [
gitAndTools.pre-commit
git-credential-manager
];
programs.gh = {
enable = true;
settings = {
version = 1;
git_protocol = "ssh";
prompt = "enabled";
aliases = {
co = "pr checkout";
vw = "pr view --web";
};
};
};
programs.git = {
enable = true;
delta = {
enable = true;
options.features = "decorations side-by-side line-numbers";
};
userName = lib.mkDefault userinfo.fullName;
userEmail = lib.mkDefault userinfo.email;
aliases = {
amend = "commit --amend";
a = "commit --amend --no-edit";
st = "status";
co = "checkout";
br = "branch";
rb = "pull --rebase";
hist = "log --pretty=format:\"%Cgreen%h %Creset%cd %Cblue[%cn] %Creset%s%C(yellow)%d%C(reset)\" --graph --date=relative --decorate --all";
llog = "log --graph --name-status --pretty=format:\"%C(red)%h %C(reset)(%cd) %C(green)%an %Creset%s %C(yellow)%d%Creset\" --date=relative";
logo = "log --pretty=format:\"%C(yellow)%h%Cred%d %Creset%s%Cblue (%cn)\" --decorate";
logf = "log --pretty=format:\"%C(yellow)%h%Cred%d %Creset%s%Cblue (%cn)\" --decorate --numstat";
};
# https://stackoverflow.com/questions/74012449/git-includeif-hasconfigremote-url-not-working
# to test it's working as expected:
# run `git config --get-all user.email' in a repository to check that we get all the possible emails
# run `git config --get user.email' in a repository to check which email is selected
includes = [
{
condition = "hasconfig:remote.*.url:git@github.rbx.com:*/**";
path = pkgs.writeText "username.cfg" (lib.generators.toGitINI { user.email = "fcuny@roblox.com"; });
}
{
condition = "hasconfig:remote.*.url:git@github.com:Roblox/**";
path = pkgs.writeText "username.cfg" (lib.generators.toGitINI { user.email = "fcuny@roblox.com"; });
}
{
condition = "hasconfig:remote.*.url:https://github.com/Roblox/**";
path = pkgs.writeText "username.cfg" (lib.generators.toGitINI { user.email = "fcuny@roblox.com"; });
}
{
condition = "hasconfig:remote.*.url:https://github.rbx.com/*/**";
path = pkgs.writeText "username.cfg" (lib.generators.toGitINI { user.email = "fcuny@roblox.com"; });
}
];
ignores = [
".DS_Store"
".aider.*"
".direnv"
".envrc"
];
extraConfig = {
core.whitespace = "trailing-space,space-before-tab";
color.ui = true;
# nicer output
column.ui = "auto";
# https://adamj.eu/tech/2024/01/18/git-improve-diff-histogram/
diff.algorithm = "histogram";
init.defaultBranch = "main";
# https://blog.gitbutler.com/how-git-core-devs-configure-git/
push = {
# abort if the remote branch does not match the local one
default = "simple";
autoSetupRemote = true;
followTags = true;
};
fetch = {
prune = true;
pruneTags = true;
all = true;
};
pull.rebase = true;
rebase = {
autosquash = true;
updateRefs = true;
# Automatically create a temporary stash entry before the
# operation begins, and apply it after the operation ends.
autoStash = true;
# Print a warning if some commits are removed
missingCommitsCheck = "warn";
};
branch = {
autosetuprebase = "remote";
sort = "authordate";
};
url = {
"ssh://git@github.rbx.com/" = {
insteadOf = "https://github.rbx.com/";
};
};
};
};
}
|