fix bak diff without parameters
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 6 Aug 2010 14:31:46 +0000 (16:31 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 6 Aug 2010 14:31:46 +0000 (16:31 +0200)
hostname must end with / to prevent error from git:
ambiguous argument 'arh-hw': both revision and filename
to support branches named as hosts

TODO
bak-git-server.pl

diff --git a/TODO b/TODO
index 84a6349..8661903 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,6 +1,6 @@
 + commit --author support
 + diff/revert from another host:/paths/
-- bak diff without params doesn't return full host diff
++ bak diff without params doesn't return full host diff
 - bak ls
 - daily cron job to create branch with uncommited changes
 - bak cat host:/path/to/file
index a87473e..f591fc6 100755 (executable)
@@ -164,7 +164,11 @@ while (my $client = $server->accept()) {
                        }
                } else {
                        # commands without path will show host-wide status/changes
-                       print $client git($command, $rel_path ? $backup_path : $hostname);
+                       my $backup_path = $rel_path ? $backup_path : "$hostname/";
+                       # hostname must end with / to prevent error from git:
+                       # ambiguous argument 'arh-hw': both revision and filename
+                       # to support branches named as hosts
+                       print $client git($command, $backup_path);
                }
        } elsif ( $command eq 'revert' ) {
                if ( $on_host ) {