From 99a052d4fa20cd3e29e5ff31d6793e3d3a96a017 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 9 Apr 2011 10:12:35 +0100 Subject: Fix asd to also work with git. --- scripts/asd | 25 ++++++++++++++++++------- 1 file 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" ] -- cgit v1.2.1