Fix cg-patch hanging on terminals with TOSTOP flag
PATCH 1/2 Fix cg-patch hanging on terminals with TOSTOP flag
From: Pavel Roskin <[email protected]>
Terminals with TOSTOP flag don't allow background processes to write to the terminal. This flag is used e.g. by the subshell in GNU Midnight Commander. It can also be set by "stty tostop".
Redirect stdout and strerr of the "patch" command to a temporary file and show it once "patch" terminates.
---
cg-patch | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
cg-patch +4 -2
@@ -337,6 +337,7 @@ # parts of the tree from inadverent poll [ "$unidiff" ] && newsfile="$(mktemp -t gitapply.XXXXXX)" gonefile="$(mktemp -t gitapply.XXXXXX)" todo="$(mktemp -t gitapply.XXXXXX)" +patchout="$(mktemp -t gitapply.XXXXXX)" patchfifo="$(mktemp -t gitapply.XXXXXX)" rm "$patchfifo" && mkfifo -m 600 "$patchfifo"
@@ -347,7 +348,7 @@ # patch file removal behaviour cannot be # just handle it all ourselves. patch_args="-p$strip -N" [ "$reverse" ] && patch_args="$patch_args -R" -patch $patch_args <"$patchfifo" & +patch $patch_args <"$patchfifo" >"$patchout" 2>&1 & tee "$patchfifo" | { redzone_reset
@@ -407,6 +408,7 @@ tee "$patchfifo" | { } >$todo wait %1; ret=$? +cat "$patchout" IFS=$'\n' emptyfiles=($(git-ls-files --deleted | join -v 2 "$gonefile" -)) if [ "$unidiff" ]; then
@@ -441,7 +443,7 @@ while [ "$1" ]; do done ' padding -rm "$patchfifo" "$todo" "$gonefile" +rm "$patchfifo" "$todo" "$gonefile" "$patchout" [ "$unidiff" ] && rm "$newsfile" exit $ret
PATCH 2/2 Improve the tutorial script
From: Pavel Roskin <[email protected]>
Use a function to imitate differern users. Set environment variables so the the names of the users are actually used in the commits.
Further limit direct use of git. Stop using git for patch transmission. Use cg-mkpatch and cg-patch instead. Don't even attempt octopus merge to avoid confusing users.
Don't use obsolete "-d" flag for cg-tag.
Rewrite many comments to make the tutorial more coherent. Group commands in a more logical way.
Suppress "ed" output. Strip trailing spaces.
---
Documentation/tutorial-script/0000-playground.sh | 6 - Documentation/tutorial-script/script.sh | 237 ++++++++++++---------- 2 files changed, 129 insertions(+), 114 deletions(-)
Documentation/tutorial-script/0000-playground.sh deleted +0 -6
@@ -1,6 +0,0 @@ -#!/bin/sh - -rm -rf Playground -mkdir Playground -cd Playground -mkdir Alice Bob Charlie
Documentation/tutorial-script/script.sh +129 -108
421 lines not on this page · raw message