Skip to content

Commit cad05f7

Browse files
thinkyheadLCh-77
authored andcommitted
🔨 Fix mfprep string test
1 parent 728b914 commit cad05f7

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

buildroot/share/git/mfprep

+14-13
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,33 @@ DRYRUN=0
1818
TAG1=$1
1919
TAG2=${2:-"HEAD"}
2020

21+
DEST=2.1.x
22+
2123
# Validate that the required tags exist
2224

2325
MTAG=`git tag | grep -e "^bf-$TAG1\$"`
24-
[[ -n $MTAG ]] || { echo "Can't find tag bf-$TAG1" ; exit 1 ; }
26+
[[ -n "$MTAG" ]] || { echo "Can't find tag bf-$TAG1" ; exit 1 ; }
2527
MTAG=`git tag | grep -e "^$TAG1\$"`
26-
[[ -n $MTAG ]] || { echo "Can't find tag $TAG1" ; exit 1 ; }
28+
[[ -n "$MTAG" ]] || { echo "Can't find tag $TAG1" ; exit 1 ; }
2729

28-
# Generate log of recent commits for bugfix-2.0.x and 2.0.x
30+
# Generate log of recent commits for bugfix-2.0.x and DEST
2931

3032
TMPDIR=`mktemp -d`
3133
LOGB="$TMPDIR/log-bf.txt"
32-
LOG2="$TMPDIR/log-20x.txt"
34+
LOG2="$TMPDIR/log-2x.txt"
3335
TMPF="$TMPDIR/tmp.txt"
34-
SCRF="$TMPDIR/update-20x.sh"
36+
SCRF="$TMPDIR/update-$DEST.sh"
3537

3638
git checkout bugfix-2.0.x
3739
git log --pretty="[%h] %s" bf-$TAG1..$TAG2 | grep -v '\[cron\]' | $SED '1!G;h;$!d' >"$LOGB"
3840

39-
git checkout 2.0.x
41+
git checkout $DEST
4042
git log --pretty="[%h] %s" $TAG1..$TAG2 | $SED '1!G;h;$!d' >"$LOG2" || { echo "Can't find tag bf-$TAG1" ; exit 1 ; }
4143

42-
# Go through commit text from 2.0.x removing all matches from the bugfix log
44+
# Go through commit text from DEST removing all matches from the bugfix log
4345

4446
cat "$LOG2" | while read line; do
45-
#echo "... $line"
46-
if [[ $line =~ \(((#[0-9]{5}),* *)((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?\)$ ]]; then
47+
if [[ $line =~ \(((#[0-9]{5}),* *)((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?\)$ ]]; then
4748
PATT=""
4849
for i in ${!BASH_REMATCH[@]}; do
4950
if ((i > 0 && (i % 2 == 0))); then
@@ -54,16 +55,16 @@ cat "$LOG2" | while read line; do
5455
fi
5556
done
5657
#echo "... $PATT"
57-
[[ -n $PATT ]] && { grep -vE "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; }
58+
[[ -n "$PATT" ]] && { grep -vE "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; }
5859
else
5960
PATT=$( $SED -E 's/^\[[0-9a-f]{10}\]( . )?(.+)$/\2/' <<<"$line" )
60-
[[ -n $PATT ]] && { grep -v "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; }
61+
[[ -n "$PATT" ]] && { grep -v "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; }
6162
fi
6263
done
6364

6465
# Convert remaining commits into git commands
6566

66-
echo -e "#!/usr/bin/env bash\nset -e\ngit checkout 2.0.x\n" >"$TMPF"
67+
echo -e "#!/usr/bin/env bash\nset -e\ngit checkout ${DEST}\n" >"$TMPF"
6768
cat "$LOGB" | while read line; do
6869
if [[ $line =~ ^\[([0-9a-f]{10})\]\ *(.*)$ ]]; then
6970
CID=${BASH_REMATCH[1]}
@@ -74,6 +75,6 @@ cat "$LOGB" | while read line; do
7475
fi
7576
done
7677
mv "$TMPF" "$SCRF"
77-
chmod ug+x "$SCRF"
78+
chmod +x "$SCRF"
7879

7980
((DRYRUN)) && rm -r "$TMPDIR" || open "$TMPDIR"

0 commit comments

Comments
 (0)