Skip to content

Commit 2c19800

Browse files
committed
Detect the base commit in extract-patches.sh
* Detect the base commit in extract-patches.sh * Fix: hard-coded src/cli * Fix: don't prevent nested submodule patch support (cherry picked from commit 1bda26d)
1 parent 6272f0a commit 2c19800

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

extract-patches.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
set -euo pipefail
33
IFS=$'\n\t'
44

5+
getIndexedSubmoduleSha() {
6+
(
7+
cd ".."
8+
git ls-tree HEAD "$REPO_NAME" | awk '{print $3}'
9+
)
10+
}
11+
512
SOURCE="${BASH_SOURCE[0]}"
613
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
714
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
@@ -10,9 +17,9 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
1017
done
1118
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
1219

13-
BASE_SHA=$1
1420
REPO_NAME=$(basename $(pwd))
1521
PATCHES_DIR=$DIR/patches/$REPO_NAME
22+
BASE_SHA=${1:-$(getIndexedSubmoduleSha)}
1623

1724
if [ ! -d $PATCHES_DIR ]; then
1825
mkdir -p $PATCHES_DIR

0 commit comments

Comments
 (0)