Add git-exclude
A Git commit that easily excludes files by adding them to `.git/info/exclude`.
This commit is contained in:
parent
a620888277
commit
d4e5faf6c4
3 changed files with 26 additions and 0 deletions
|
@ -169,6 +169,7 @@ in
|
|||
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
git-exclude
|
||||
git-extras
|
||||
git-graph
|
||||
git-trim
|
||||
|
|
|
@ -14,6 +14,7 @@ in
|
|||
dev-commit = callPackage ./dev-commit.nix { };
|
||||
displayselect = callPackage ./displayselect { };
|
||||
get-tags = callPackage ./get-tags.nix { };
|
||||
git-exclude = callPackage ./git-exclude.nix { };
|
||||
git-graph = callPackage ./git-graph.nix { };
|
||||
mounter = callPackage ./mounter.nix { };
|
||||
move-firefox-screenshots = callPackage ./move-firefox-screenshots.nix { };
|
||||
|
|
24
packages/git-exclude.nix
Normal file
24
packages/git-exclude.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "git-exclude";
|
||||
|
||||
runtimeInputs = with pkgs; [ git ];
|
||||
|
||||
text = ''
|
||||
# Based on https://github.com/jfly/snow/blob/fb727b39736666f54908f4dc7c83dd6284607c5a/machines/pattern/homies/bin/git-exclude.
|
||||
|
||||
root=$(git rev-parse --show-toplevel)
|
||||
rel=$(realpath --relative-to "$root" .)
|
||||
|
||||
# For some reason, ignore rules like "./.envrc" don't seem to work, but
|
||||
# "/.envrc" does. :shrug:
|
||||
if [ "$rel" = "." ]; then
|
||||
rel=""
|
||||
fi
|
||||
|
||||
for item in "$@"; do
|
||||
echo "''${rel}/$item" >> "$root/.git/info/exclude"
|
||||
done
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue