[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] [PATCH RFC] Reuse the shell
From: |
Jean Delvare |
Subject: |
[Quilt-dev] [PATCH RFC] Reuse the shell |
Date: |
Mon, 21 Jun 2021 18:33:26 +0200 |
One side effect of commit ca85fbd82022 ("Move the code which adds the
default parameters from quiltrc") is that we now source the quiltrc
configuration file twice. While parsing this file shouldn't take
overly long, this still feels conceptually wrong.
This can be avoided by reusing the same shell for the quilt command
as we used for the quilt "launcher" itself, instead of starting a
new instance of bash for it.
As a nice side bonus, this makes quilt 1-2% faster (measured on
the test suite).
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
Andreas, do you expect any problem with this change? Did you have a
reason for running commands in their own shell in the first place?
bin/quilt.in | 5 ++++-
quilt/scripts/patchfns.in | 9 +++------
2 files changed, 7 insertions(+), 7 deletions(-)
--- quilt.orig/bin/quilt.in 2021-06-18 19:10:22.022985352 +0200
+++ quilt/bin/quilt.in 2021-06-21 14:11:44.546661397 +0200
@@ -163,7 +163,10 @@ if [ -n "$QUILT_COMMAND" ]; then
unset args
fi
-bash $BASH_OPTS -c ". $QUILT_DIR/$command" "quilt ${command##*/}" "$@"
+if [ -n "$BASH_OPTS" ]; then
+ set $BASH_OPTS
+fi
+. "$QUILT_DIR/$command"
### Local Variables:
### mode: shell-script
### End:
--- quilt.orig/quilt/scripts/patchfns.in 2021-06-18 19:10:22.022985352
+0200
+++ quilt/quilt/scripts/patchfns.in 2021-06-21 15:19:49.591074152 +0200
@@ -28,11 +28,6 @@ fi
unset CDPATH
shopt -s dotglob
-if [ -e "$QUILTRC" ]
-then
- source "$QUILTRC"
-fi
-
. $QUILT_DIR/scripts/utilfns
# ========================================================
@@ -1079,8 +1074,10 @@ quilt_command()
# the command line
export QUILT_NO_DIFF_INDEX
export QUILT_NO_DIFF_TIMESTAMPS
+ # Propagate tracing options in case we are called recursively
+ export BASH_OPTS
- QUILT_COMMAND="" bash $BASH_OPTS -c "${SUBDIR:+cd $SUBDIR;} .
$QUILT_DIR/$command" "quilt $command" "$@"
+ QUILT_COMMAND="" bash $BASH_OPTS -c "${SUBDIR:+cd $SUBDIR;} [ ! -e
\"$QUILTRC\" ] || source \"$QUILTRC\"; . $QUILT_DIR/$command" "quilt $command"
"$@"
}
check_external_tool()
--
Jean Delvare
SUSE L3 Support
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Quilt-dev] [PATCH RFC] Reuse the shell,
Jean Delvare <=