Przeglądaj źródła

Update try_git logic for worktrees

master
Mitch Tishmack 6 lat temu
rodzic
commit
d1c558e4e2
1 zmienionych plików z 8 dodań i 5 usunięć
  1. +8
    -5
      dotprofile.org

+ 8
- 5
dotprofile.org Wyświetl plik

@@ -242,7 +242,7 @@ try_git()

if [ ! -d "${repo}" ]; then
if git ls-remote "${rrepo}" > /dev/null 2>&1; then
mkdir -p "${repo}"
install -dm755 "${repo}"
echo "git clone ${rrepo} ${repo}"
git clone --recursive "${rrepo}" "${repo}"
else
@@ -252,13 +252,16 @@ try_git()

if [ "${branch}" != "master" ]; then
wtdir="${repo}@${branch}"
if [ -d "${wtdir}" ]; then
cd "${wtdir}"
else
if [ ! -d "${wtdir}" ]; then
if git branch -r --list 'origin/*' | grep -E "^\s+origin/${branch}$" > /dev/null 2>&1; then
git worktree add ${repo}@${branch} ${branch} && cd "${wtdir}"
git worktree add ${repo}@${branch} ${branch}
else
echo "${wtdir} branch ${branch} not present in ${rrepo}"
return
fi
fi
echo "${wtdir}" | sed -e "s|$HOME|~|"
cd "${wtdir}"
else
if [ -d "${repo}" ]; then
echo "${repo}" | sed -e "s|$HOME|~|"


Ładowanie…
Anuluj
Zapisz