]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/git.nix
patate: tweak davfs2
[julm/julm-nix.git] / home-manager / profiles / git.nix
1 { pkgs, lib, config, ... }:
2 {
3 home.packages = [
4 pkgs.git-chglog
5 pkgs.git-crypt
6 pkgs.git-quick-stats
7 ];
8 programs.git = {
9 enable = true;
10 ignores = [ "*~" "*.swp" ];
11 package = lib.mkDefault pkgs.gitMinimal;
12 aliases = {
13 a = "add";
14 ap = "add -p";
15 authors = "shortlog -s -n";
16 bl = "git log -p -M --follow --stat --";
17 b = "branch";
18 c = "commit";
19 ca = "commit --amend";
20 caa = "commit --amend -C@";
21 caaa = "commit --amend -C@ -a";
22 cf = "commit --fixup";
23 co = "checkout";
24 d = "diff";
25 dc = "diff --cached";
26 dh = "diff --histogram";
27 dp = "diff --patience";
28 g = "grep";
29 ign = "ls-files -o -i --exclude-standard";
30 l = "log";
31 ll = "log --graph --decorate --pretty=oneline --abbrev-commit";
32 lp = "log -p --pretty=fuller";
33 lpg = "log -p --pretty=fuller -g";
34 p = "push -v";
35 pf = "push -vf";
36 pu = "pull";
37 r = "reset";
38 rh = "reset --hard";
39 ri = "rebase -i";
40 rp = "reset -p";
41 s = "status";
42 spull = "!git-svn fetch && git-svn rebase";
43 spush = "!git-svn dcommit";
44 ss = "status -s";
45 st = "status -uno";
46 sw = "switch";
47 fetch-local = "!git fetch local && git tag -d $(git describe --exact-match 2>/dev/null >/dev/null) && git fetch --tags local";
48 pull-local = "!git fetch-local && git checkout -B master local/master";
49 pull-local-old = "!git fetch-local && git checkout HEAD'^' && git branch -f master local/master && git checkout master";
50 root = ''!git rev-list --parents HEAD | egrep "^[a-f0-9]{40}$"'';
51 has-tag-version = ''!git show-ref --tags -d | grep -qx \"^$(git rev-parse HEAD) refs/tags/v[0-9][0-9][0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9]\\(\\^{}\\)\\?\"'';
52 tag-version = ''"!git has-tag-version && return; v=$(TZ=UTC date +v%Y-%m-%d) && name=$(git rev-parse --show-toplevel | sed -e 's:^.*/work::') && set -x && git tag -s -m \"$name $v\" $v"'';
53 has-tag-majordate = ''!git show-ref --tags -d | grep -qx \"^$(git rev-parse HEAD) refs/tags/v[0-9]\\+.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\\(\\^{}\\)\\?\"'';
54 tag-majordate = ''"!git has-tag-majordate && return; name=$(basename $(dirname $(git rev-parse --show-toplevel))); major=$(basename $(git rev-parse --show-toplevel)); version=''${version:-$(TZ=UTC date +\"v$major.%Y%m%d\")} && set -x && git tag -s -m \"$name $version\" $version"'';
55 tag-cabal = ''"!set -x; for cabal in $(git ls-files | grep '.*\\.cabal$'); do name=$(sed -ne 's/^name: *\\(.*\\)/\\1/p' \"$cabal\"); version=$(sed -ne 's/^version: *\\(.*\\)/\\1/p' \"$cabal\"); git tag --merged | grep -Fqx \"$name-$version\" || git tag -f -s -m \"$name v$version\" $name-$version; done"'';
56 cl = "notes --ref=changelog append";
57 cl-bug = "notes --ref=changelogs/bugs append";
58 cl-feature = "notes --ref=changelogs/features append";
59 wip = "for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads";
60 };
61 extraConfig = {
62 push.default = "simple";
63 color.diff = "auto";
64 #color.diff.whitespace = "red reverse";
65 color.status = "auto";
66 color.branch = "auto";
67 core.whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol";
68 core.quotepath = "false";
69 diff.algorithm = "histogram";
70 diff.sqldiff.command = "sqldiff";
71 format.pretty = "oneline";
72 init.defaultBranch = "main";
73 web.browser = "elinks";
74 browser.elinks.cmd = "elinks";
75 sendemail.chainReplyTo = "false";
76 sendemail.composeencoding = "UTF-8";
77 sendemail.confirm = "always";
78 sendemail.envelopeSender = "auto";
79 sendemail.multiedit = "yes";
80 sendemail.suppresscc = "self";
81 sendemail.suppressFrom = "false";
82 sendemail.thread = "true";
83 sendemail.validate = "true";
84 merge.tool = "vimdiff";
85 protocol.version = 2;
86 pull.rebase = true;
87 rebase.autosquash = "true";
88 };
89 };
90 }