Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/target
/result

# Nix / devenv
/.devenv/
Expand Down
30 changes: 30 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,36 @@ This is a small tool that helps to list the files you have changed (added/modifi
This can be useful when working with large repositories, as you can run tools on a specific subset of files instead of the entire repository.
It can be easily integrated into your workflow to streamline your development process.

** Install with Nix

This project is a Nix flake. It gives you the ~git-changed~ package, an overlay and an app.

Run the tool without an installation:

#+begin_src bash
$ nix run github:function-artisans/git-changed
#+end_src

Add the flake to your own configuration:

#+begin_src nix
{
inputs.git-changed.url = "github:function-artisans/git-changed";
}
#+end_src

Then take the package for your system:

#+begin_src nix
inputs.git-changed.packages.${system}.default
#+end_src

Or add the overlay and take ~pkgs.git-changed~:

#+begin_src nix
nixpkgs.overlays = [ inputs.git-changed.overlays.default ];
#+end_src

** Usage

To get the recent changes comparing to the default branch you can type:
Expand Down
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
description = "Lists files modified since branching off";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

outputs =
{ self, nixpkgs }:
let
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];

forEachSystem = nixpkgs.lib.genAttrs systems;
in
{
overlays.default = final: _prev: {
git-changed = final.callPackage ./package.nix { };
};

packages = forEachSystem (system: {
git-changed = nixpkgs.legacyPackages.${system}.callPackage ./package.nix { };
default = self.packages.${system}.git-changed;
});

apps = forEachSystem (system: rec {
git-changed = {
type = "app";
program = nixpkgs.lib.getExe self.packages.${system}.git-changed;
meta.description = "List the files that changed since the branch point";
};
default = git-changed;
});

checks = forEachSystem (system: {
inherit (self.packages.${system}) git-changed;
});
};
}
38 changes: 38 additions & 0 deletions package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
lib,
rustPlatform,
pkg-config,
libgit2,
git,
}:

rustPlatform.buildRustPackage {
pname = "git-changed";
version = "0.0.1";

src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./Cargo.lock
./Cargo.toml
./src
./tests
];
};

cargoLock.lockFile = ./Cargo.lock;

# Link the libgit2 of nixpkgs. The git2 crate then builds no copy of its own.
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libgit2 ];
env.LIBGIT2_NO_VENDOR = 1;

# The test scenarios create their repositories with the git command.
nativeCheckInputs = [ git ];

meta = {
description = "Lists files modified since branching off";
homepage = "https://github.com/function-artisans/git-changed";
mainProgram = "git-changed";
};
}
Loading