From e727e366d386cb49590c2c65969817f89583656a Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 17 Sep 2023 10:57:46 -0400 Subject: factor out finding the git root --- config/git/config | 1 + config/sh/functions | 8 +------- 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'config') diff --git a/config/git/config b/config/git/config index 48afbdc..851611e 100644 --- a/config/git/config +++ b/config/git/config @@ -32,6 +32,7 @@ re = rebase -i @{u} r = !git record ri = rebase -i + root = !~/.bin/git/git-root rv = checkout -p stashed = stash list --pretty=format:'%<(10)%gd: %Cred%h%Creset %Cgreen(%ar)%Creset%n %s' st = status -sb diff --git a/config/sh/functions b/config/sh/functions index 76db947..b64c4cf 100644 --- a/config/sh/functions +++ b/config/sh/functions @@ -8,13 +8,7 @@ function perldoc { } function cdu { - local root - root="$(git rev-parse --show-superproject-working-tree 2>/dev/null)" - if [ -n "$root" ]; then - cd "$root" || return - else - cd "$(git rev-parse --show-toplevel)" || return - fi + cd "$(git root)" || return } # vim:ft=sh: -- cgit v1.2.3-54-g00ecf