Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15

Re: Handling merge conflicts a bit more gracefully..

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2016-06-15 22:42:00

Possibly related (same subject, not in this thread)

Linus Torvalds [off-list ref] wrote:
quoted
 # Modified in both, but differently.
+     merge -p "$src1" "$orig" "$src2" > "$4"

Again, make sure "$4" is not a directory before redirecting into
it from merge, so that you can tell merge failures from it?
Hmm.. What's the cleanest way to check for redirection errors, but still
be able to distinguish those cleanly from "merge" itself returning an
error?
I don't know whether this is the cleanest, but this is one way:

redir=failed
{
	redir=ok
	merge -p "$src1" "$orig" "$src2"
} > "$4" || err=$?

if [ $redir = failed ]; then
	...
fi

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help