Skip to content

Commit

Permalink
server: maintain current LocalRepo var
Browse files Browse the repository at this point in the history
This will be useful for upcoming vfs operations.

Signed-off-by: Rob Browning <[email protected]>
Tested-by: Rob Browning <[email protected]>
  • Loading branch information
rlbdv committed Jan 13, 2019
1 parent 17f54bb commit 5962b7e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/server-cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
from bup.git import MissingObject
from bup.helpers import (Conn, debug1, debug2, linereader, lines_until_sentinel,
log)
from bup.repo import LocalRepo


suspended_w = None
dumb_server_mode = False

repo = None

def do_help(conn, junk):
conn.write('Commands:\n %s\n' % '\n '.join(sorted(commands)))
Expand All @@ -31,9 +32,15 @@ def _set_mode():


def _init_session(reinit_with_new_repopath=None):
global repo
if reinit_with_new_repopath is None and git.repodir:
if not repo:
repo = LocalRepo()
return
git.check_repo_or_die(reinit_with_new_repopath)
if repo:
repo.close()
repo = LocalRepo()
# OK. we now know the path is a proper repository. Record this path in the
# environment so that subprocesses inherit it and know where to operate.
os.environ['BUP_DIR'] = git.repodir
Expand Down

0 comments on commit 5962b7e

Please sign in to comment.