From a7e2b49bea87df836720e65410825594c93ad9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Fri, 4 Oct 2024 17:48:40 +0200 Subject: [PATCH] git-sync supports jj So much nicer! --- hm/git/default.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hm/git/default.nix b/hm/git/default.nix index 9da5aa1..b61db02 100644 --- a/hm/git/default.nix +++ b/hm/git/default.nix @@ -17,10 +17,18 @@ in else ( cd "${r.path}" - ${pkgs.git}/bin/git --no-optional-locks diff --quiet || echo "Repository is dirty!" - ${pkgs.git}/bin/git pull || true - # Only push if there's something to push. Also prevents from trying to push on repos where we don't have rights. - (${pkgs.git}/bin/git --no-optional-locks status --porcelain -b --ignore-submodules | grep ' \[ahead [0-9]\+\]' && ${pkgs.git}/bin/git push) || true + if [ -d .jj ] + then + jj git fetch + jj rebase -d main@origin + jj branch set main -r @- + jj git push + else + ${pkgs.git}/bin/git --no-optional-locks diff --quiet || echo "Repository is dirty!" + ${pkgs.git}/bin/git pull || true + # Only push if there's something to push. Also prevents from trying to push on repos where we don't have rights. + (${pkgs.git}/bin/git --no-optional-locks status --porcelain -b --ignore-submodules | grep ' \[ahead [0-9]\+\]' && ${pkgs.git}/bin/git push) || true + fi ) fi '')