[dim PATCH v2 4/7] dim: return exit status instead of actually exiting from url_to_remote

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This lets us handle url_to_remote failures gracefully where they're not
fatal. Our use of 'set -e' guarantees this will bail out otherwise.

Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
---
 dim | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dim b/dim
index 1d52d509450d..3c7b6fc1343b 100755
--- a/dim
+++ b/dim
@@ -205,7 +205,7 @@ function url_to_remote # url
 
 	if [[ -z "$url" ]]; then
 		echoerr "$0 without url"
-		exit 1
+		return 1
 	fi
 
 	remote=$(git remote -v | grep -m 1 "$url" | cut -f 1)
@@ -215,10 +215,12 @@ function url_to_remote # url
 		echoerr "Please set it up using:"
 		echoerr "    $ git remote add <name> $url"
 		echoerr "with a name of your choice."
-		exit 1
+		return 1
 	fi
 
 	echo $remote
+
+	return 0
 }
 
 function branch_to_remote # branch
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux