Skip to content

Commit

Permalink
Changes done for git subtree installation for git feature which is re…
Browse files Browse the repository at this point in the history
…lated to features repo issue devcontainers#1143
  • Loading branch information
Kaniska244 committed Dec 16, 2024
1 parent bca4043 commit 24d0122
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/git/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/git-from-src.md
# Maintainer: The VS Code and Codespaces Teams

set -ex

GIT_VERSION=${VERSION} # 'system' checks the base image first, else installs 'latest'
USE_PPA_IF_AVAILABLE=${PPA}
INSTALL_SUBTREE="${INSTALLSUBTREE:-"true"}"
Expand Down Expand Up @@ -209,7 +211,12 @@ export DEBIAN_FRONTEND=noninteractive
if [ ${GIT_VERSION} = "os-provided" ] || [ ${GIT_VERSION} = "system" ]; then
if type git > /dev/null 2>&1; then
echo "Detected existing system install: $(git version)"
# Clean up
if [[ $INSTALL_SUBTREE = "true" ]]; then
cd /usr/share/
git clone https://github.com/git/git.git
cd git/contrib/subtree
make && make install && make install-doc && cp git-subtree ../.. 2>&1
fi
clean_up
exit 0
fi
Expand All @@ -225,6 +232,28 @@ if [ ${GIT_VERSION} = "os-provided" ] || [ ${GIT_VERSION} = "system" ]; then
check_packages ca-certificates
fi
check_packages git
if [[ $INSTALL_SUBTREE = "true" ]]; then
if ! type make > /dev/null 2>&1; then
check_packages make
fi
if ! type asciidoc > /dev/null 2>&1; then
check_packages asciidoc
fi
if ! type xmlto > /dev/null 2>&1; then
check_packages xmlto
fi
if ! type getopt > /dev/null 2>&1; then
check_packages getopt
fi
cd /usr/share/
git clone https://github.com/git/git.git
cd git/contrib/subtree
make && make install && make install-doc && cp git-subtree ../.. 2>&1
export PATH=$PATH:/usr/share/git
# Persist the PATH change by adding it to .bashrc
echo 'export PATH=$PATH:/usr/share/git' >> ~/.bashrc
echo $PATH
fi
# Clean up
clean_up
exit 0
Expand Down

0 comments on commit 24d0122

Please sign in to comment.