Skip to content

Commit

Permalink
Changed the installation part for git subtree
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaniska244 committed Dec 19, 2024
1 parent 0e75385 commit eb6ad3b
Showing 1 changed file with 34 additions and 9 deletions.
43 changes: 34 additions & 9 deletions src/git/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
# 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 @@ -212,8 +210,26 @@ if [ ${GIT_VERSION} = "os-provided" ] || [ ${GIT_VERSION} = "system" ]; then
if type git > /dev/null 2>&1; then
echo "Detected existing system install: $(git version)"
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 tar > /dev/null 2>&1; then
check_packages tar
fi
if ! type curl > /dev/null 2>&1; then
check_packages curl
fi
cd /usr/share/
git clone https://github.com/git/git.git
curl -sL https://github.com/git/git/tarball/master -o git-repo.tar.gz
mkdir git
tar -xzvf git-repo.tar.gz -C git --strip-components=1
cd git/contrib/subtree
make && make install && make install-doc && cp git-subtree ../.. 2>&1
fi
Expand Down Expand Up @@ -242,17 +258,26 @@ if [ ${GIT_VERSION} = "os-provided" ] || [ ${GIT_VERSION} = "system" ]; then
if ! type xmlto > /dev/null 2>&1; then
check_packages xmlto
fi
if ! type getopt > /dev/null 2>&1; then
check_packages getopt
fi
if ! type tar > /dev/null 2>&1; then
check_packages tar
fi
if ! type curl > /dev/null 2>&1; then
check_packages curl
fi
if ! type cmp > /dev/null 2>&1; then
check_packages diffutils
fi
cd /usr/share/
git clone https://github.com/git/git.git
curl -sL https://github.com/git/git/tarball/master -o git-repo.tar.gz
mkdir git
tar -xzvf git-repo.tar.gz -C git --strip-components=1
cd git/contrib/subtree
make && make install && make install-doc && cp git-subtree ../.. 2>&1
make && make install && make install-doc 2>&1
cp git-subtree ../..
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
echo $PATH
fi
# Clean up
clean_up
Expand Down

0 comments on commit eb6ad3b

Please sign in to comment.