aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2019-05-25 11:45:10 +0200
committerTeddy Wing2019-05-25 11:45:10 +0200
commit33515f18b84997693baf1ca842f4297fb77edbd0 (patch)
treec7cf270413a5366f41c6c2245860748fec0dff7d
parent94fcc86499cea2fc6c751a1b18d61f6cc6d3a7b9 (diff)
parent18ec1361d4eea49066aa12ccb2b173f196962f66 (diff)
downloadgit-branch-list-33515f18b84997693baf1ca842f4297fb77edbd0.tar.bz2
Merge branch 'make-program-work-in-subdirectories'
-rwxr-xr-xgit-branch-list3
-rw-r--r--t/105-list-works-in-subdirectory.t17
2 files changed, 19 insertions, 1 deletions
diff --git a/git-branch-list b/git-branch-list
index 13b3ed1..ed5ef34 100755
--- a/git-branch-list
+++ b/git-branch-list
@@ -18,7 +18,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-DATABASE=.git/info/git-branch-list
+GIT_ROOT=$(git rev-parse --show-toplevel)
+DATABASE="${GIT_ROOT}/.git/info/git-branch-list"
VERSION=0.1.1
function initialise_database () {
diff --git a/t/105-list-works-in-subdirectory.t b/t/105-list-works-in-subdirectory.t
new file mode 100644
index 0000000..b236314
--- /dev/null
+++ b/t/105-list-works-in-subdirectory.t
@@ -0,0 +1,17 @@
+#!/usr/bin/env perl -w
+
+use strict;
+
+use Test::More;
+
+use Bin qw($BIN);
+
+mkdir 't-git-repo/subdirectory', 0755;
+
+chdir 't-git-repo/subdirectory' or die $!;
+
+my $branch_list = qx($BIN);
+is $branch_list, '', 'must find database file';
+
+
+done_testing;