feat(git): enable relative worktrees
This commit is contained in:
parent
bb8ac5db06
commit
4f336803ab
1 changed files with 4 additions and 22 deletions
|
@ -105,7 +105,10 @@
|
|||
|
||||
tag.sort = "version:refname";
|
||||
|
||||
worktree.guessRemote = true;
|
||||
worktree = {
|
||||
guessRemote = true;
|
||||
useRelativePaths = true;
|
||||
};
|
||||
};
|
||||
|
||||
aliases = {
|
||||
|
@ -144,26 +147,5 @@
|
|||
git -C ''${dir}/.base checkout --detach HEAD
|
||||
git -C ''${dir}/.base worktree add ../''${branch}
|
||||
'')
|
||||
|
||||
(writeShellScriptBin "git-make-relative" ''
|
||||
|
||||
gitfile=''${1}
|
||||
|
||||
if [[ -z ''${gitfile} ]]; then
|
||||
gitfile=".git"
|
||||
fi
|
||||
|
||||
if [[ ! -f ''${gitfile} ]]; then
|
||||
echo "file ''${gitfile} does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gitdir=$(grep "gitdir:" ''${gitfile} | cut -d: -f2 | xargs)
|
||||
rel_gitdir=$(realpath -s --relative-to=. ''${gitdir})
|
||||
|
||||
echo "relative path: ''${rel_gitdir}"
|
||||
|
||||
sed -i -e "s,gitdir:.*,gitdir: ''${rel_gitdir}," ''${gitfile}
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue