git: sshifyPushUrl
This commit is contained in:
parent
ab53ebc1db
commit
1874ab5f29
1 changed files with 17 additions and 0 deletions
|
@ -4,6 +4,18 @@ let
|
|||
cfg = config.snowhawk.git;
|
||||
macos = config.snowhawk.macos.enable;
|
||||
sops = config.snowhawk.sops.enable;
|
||||
|
||||
sshifyPushUrl =
|
||||
let
|
||||
urlParser = "${pkgs.url-parser}/bin/url-parser";
|
||||
git = "${pkgs.git}/bin/git";
|
||||
cut = "${pkgs.coreutils}/bin/cut";
|
||||
in
|
||||
pkgs.writeShellScriptBin "sshify-push-url" ''
|
||||
base=$(${urlParser} --url $(${git} remote get-url origin) host)
|
||||
path=$(${urlParser} --url $(${git} remote get-url origin) path | ${cut} -b 2-)
|
||||
echo "$base:$path"
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.snowhawk.git = {
|
||||
|
@ -36,6 +48,11 @@ in
|
|||
dump = "cat-file -p";
|
||||
graph = "log --graph --decorate --pretty=oneline --abbrev-commit";
|
||||
|
||||
# Convert pull url into ssh push url
|
||||
sshify-push-url = ''
|
||||
!${pkgs.bash}/bin/bash -c "git remote set-url --push origin $(${sshifyPushUrl}/bin/sshify-push-url)"
|
||||
'';
|
||||
|
||||
# local patch-wise ignore workflow
|
||||
unchanged = "update-index --assume-unchanged";
|
||||
changed = "update-index --no-assume-unchanged";
|
||||
|
|
Loading…
Reference in a new issue