mirror of
https://github.com/rwxrob/dot
synced 2024-11-14 18:12:56 +00:00
15 lines
284 B
Bash
Executable File
15 lines
284 B
Bash
Executable File
#!/bin/sh
|
|
|
|
## Prints the parent (or grandparent) directory that contains the .git
|
|
## directory (or file in the case of worktrees). Assumes $PWD if no
|
|
## argument provided.
|
|
|
|
pdgit() {
|
|
dir=${1:-$PWD}
|
|
pdir=$(pdhas .git)
|
|
test -z "$pdir" && return 1
|
|
echo "${pdir%/.git}"
|
|
}
|
|
|
|
pdgit "$@"
|