Skip to content

Commit

Permalink
CHG: Correcting handling of git commit and changes when fetch has not…
Browse files Browse the repository at this point in the history
… been used
  • Loading branch information
TidbitSoftware committed Jun 14, 2024
1 parent b5f1b8f commit c0b9d49
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ test/NightlyRun/*.tar.gz

# Custom build files #
#=====================
.issm
.PREV_COMMIT
33 changes: 19 additions & 14 deletions jenkins/jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,24 @@ fi
echo "======================================================";
echo " Determining installation type "
echo "======================================================";
if [ -a ${ISSM_DIR}/.issm ]; then
# Get list of changed files
#
CHANGES=$(git diff --name-only ORIG_HEAD HEAD)
if [ -f ${ISSM_DIR}/.PREV_COMMIT ]; then
# Fetch main branch from remote origin (this does not affect local files
# like `git pull` would)
git fetch --quiet origin main

# Retrieve previous commit SHA
PREV_COMMIT=$(cat ${ISSM_DIR}/.PREV_COMMIT)

# Print list of changed files
echo " "
echo "List of changed files"
echo "---------------------"
echo "${CHANGES}"
echo " "
# Get list of changed files
CHANGES=$(git diff --name-only ${PREV_COMMIT} FETCH_HEAD)

if [ ! "${CHANGES}" == "" ]; then
# Print list of changed files
echo " "
echo "List of changed files"
echo "---------------------"
echo "${CHANGES}"
fi

# If the contents of the externalpackages directory were modified in any
# way, check for changed external packages
Expand Down Expand Up @@ -102,10 +109,8 @@ if [ -a ${ISSM_DIR}/.issm ]; then
ISSM_COMPILATION="no"
fi
else
# Write out hidden file so we know next time that this script it run, it is
# not on a fresh copy of the repo (this is really only useful when running
# this script manually, i.e. *not* on Jenkins)
touch ${ISSM_DIR}/.issm
# Write out hidden file containing this commit's SHA
git rev-parse HEAD > ${ISSM_DIR}/.PREV_COMMIT

echo "Fresh copy of repository; building everything"
echo "-- checking for changed externalpackages... yes"
Expand Down

0 comments on commit c0b9d49

Please sign in to comment.