Skip to content

Commit 3a15e50

Browse files
authored
Merge pull request #933 from NASA-IMPACT/932-add-shell-script-to-handle-indexing-git-merging
932 add shell script to handle indexing git merging
2 parents 88f4684 + 0d34f44 commit 3a15e50

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Navigate to the correct repository
6+
cd "../../sinequa_configs"
7+
8+
# Ensure the script only runs if pointing to the correct remote
9+
REPO_URL="[email protected]:NASA-IMPACT/sde-backend.git"
10+
CURRENT_URL=$(git -C "$REPO_DIR" config --get remote.origin.url)
11+
12+
if [ "$CURRENT_URL" != "$REPO_URL" ]; then
13+
echo "Error: This script can only be run in the repository with the remote URL '$REPO_URL'."
14+
echo "Current remote URL is '$CURRENT_URL'. Exiting."
15+
exit 1
16+
fi
17+
18+
# Checkout and pull master
19+
echo "Checking out master branch..."
20+
git checkout master
21+
echo "Pulling latest changes from master..."
22+
git pull origin master
23+
24+
# Checkout and pull dev
25+
echo "Checking out dev branch..."
26+
git checkout dev
27+
echo "Pulling latest changes from dev..."
28+
git pull origin dev
29+
30+
# Checkout and pull webapp_config_generation
31+
echo "Checking out webapp_config_generation branch..."
32+
git checkout webapp_config_generation
33+
echo "Pulling latest changes from webapp_config_generation..."
34+
git pull origin webapp_config_generation
35+
36+
# Merge dev into webapp_config_generation
37+
echo "Merging dev into webapp_config_generation..."
38+
git merge -X theirs dev -m "Merge dev into webapp_config_generation branch - auto-resolved conflicts by taking dev changes"
39+
40+
# Push the changes to webapp_config_generation
41+
echo "Pushing changes to webapp_config_generation..."
42+
git push origin webapp_config_generation
43+
44+
echo "Operation completed successfully!"
45+
46+
### Begin merge of webapp into dev ###
47+
# Check the diff between webapp_config_generation and dev branches, and filter only files outside the allowed directories
48+
DIFF=$(git diff --name-only webapp_config_generation dev | grep -vE 'jobs/|sources/' || true)
49+
50+
if [ -n "$DIFF" ]; then
51+
echo "The following changes were found outside of the allowed directories:"
52+
echo "$DIFF"
53+
echo "Please resolve these changes on GitHub before proceeding."
54+
exit 1
55+
else
56+
echo "All changes are within the allowed directories. Proceeding with the merge."
57+
fi
58+
59+
# Checkout dev branch again
60+
echo "Checking out dev branch..."
61+
git checkout dev
62+
63+
# Merge webapp_config_generation into dev
64+
echo "Merging webapp_config_generation into dev..."
65+
git merge webapp_config_generation -m "Merge webapp_config_generation into dev branch"
66+
67+
# Push the changes to dev
68+
echo "Pushing changes to dev..."
69+
git push origin dev
70+
71+
git checkout master
72+
73+
# Return to the original directory
74+
cd -
75+
76+
echo "webapp_automation and dev merges comleted successfully!"

0 commit comments

Comments
 (0)