summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/asd25
1 files changed, 18 insertions, 7 deletions
diff --git a/scripts/asd b/scripts/asd
index 4b42157..b9c01d2 100755
--- a/scripts/asd
+++ b/scripts/asd
@@ -1,6 +1,6 @@
#!/bin/sh
# asd -- wrapper around sd
-# Copyright 2010 Lars Wirzenius
+# Copyright 2010, 2011 Lars Wirzenius
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,15 +26,26 @@ die()
}
+find_root()
+{
+ if bzr root > /dev/null 2>&1
+ then
+ bzr root
+ elif git rev-parse --show-toplevel > /dev/null 2>&1
+ then
+ git rev-parse --show-toplevel
+ else
+ die "Cannot find version control system root! Not bzr or git."
+ fi
+}
+
+
if [ "x$SD_REPO" = "x" ]
then
- if bzr root > /dev/null 2>&1
+ root=$(find_root)
+ if [ -d "$root/../bugs" ]
then
- root=$(bzr root)
- if [ -d "$root/../bugs" ]
- then
- export SD_REPO="$root/../bugs"
- fi
+ export SD_REPO="$root/../bugs"
fi
if [ "x$SD_REPO" = "x" ]