feat(git): add ignore aliases
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
9af0b7f86a
commit
9d060c9f52
1 changed files with 45 additions and 1 deletions
|
@ -4,7 +4,7 @@ self: {
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkIf;
|
inherit (lib) getExe mkIf;
|
||||||
|
|
||||||
cfg = config.programs.bash;
|
cfg = config.programs.bash;
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ self: {
|
||||||
contents.user = {inherit email name;};
|
contents.user = {inherit email name;};
|
||||||
};
|
};
|
||||||
mkDefaultRemote = remote: mkRemoteConf remote "matt@nelim.org" "matt1432";
|
mkDefaultRemote = remote: mkRemoteConf remote "matt@nelim.org" "matt1432";
|
||||||
|
|
||||||
|
mkGitAlias = script: "!${getExe script}";
|
||||||
in {
|
in {
|
||||||
config.programs = mkIf cfg.enable {
|
config.programs = mkIf cfg.enable {
|
||||||
git = {
|
git = {
|
||||||
|
@ -40,6 +42,48 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
|
alias = {
|
||||||
|
# https://stackoverflow.com/a/18317425
|
||||||
|
ignore = "update-index --assume-unchanged";
|
||||||
|
unignore = "update-index --no-assume-unchanged";
|
||||||
|
ignored = "!git ls-files -v | ${getExe pkgs.gnugrep} \"^[[:lower:]]\"";
|
||||||
|
|
||||||
|
untracked-ignore = mkGitAlias (pkgs.writeShellApplication {
|
||||||
|
name = "untracked-ignore";
|
||||||
|
text = ''
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "No file names provided"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
for arg in "$@"; do
|
||||||
|
echo -e "$arg\n" >> .git/info/exclude
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
untracked-unignore = mkGitAlias (pkgs.writeShellApplication {
|
||||||
|
name = "untracked-unignore";
|
||||||
|
text = ''
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "No file names provided"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
for arg in "$@"; do
|
||||||
|
sed -i "s/$arg//" .git/info/exclude
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
untracked-ignored = mkGitAlias (pkgs.writeShellApplication {
|
||||||
|
name = "untracked-ignored";
|
||||||
|
text = ''
|
||||||
|
while IFS= read -r line; do
|
||||||
|
if [[ "$line" != "" ]] && [[ "$line" != "#"* ]]; then
|
||||||
|
echo "$line"
|
||||||
|
fi
|
||||||
|
done < .git/info/exclude
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
diff.sopsdiffer.textconv = "sops --config /dev/null -d";
|
diff.sopsdiffer.textconv = "sops --config /dev/null -d";
|
||||||
|
|
||||||
# https://github.com/dandavison/delta/issues/630#issuecomment-860046929
|
# https://github.com/dandavison/delta/issues/630#issuecomment-860046929
|
||||||
|
|
Loading…
Reference in a new issue