summaryrefslogtreecommitdiff
path: root/contrib/remote-helpers/git-remote-hg
diff options
context:
space:
mode:
authorLibravatar Felipe Contreras <felipe.contreras@gmail.com>2013-12-07 07:09:41 -0600
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-12-09 13:18:43 -0800
commit0c0ebc1fdf57c3ac968e1afdadbc17b9010da6fa (patch)
treeaf6a810259c1290b8e6bbbcbe5e3daf8827d01fe /contrib/remote-helpers/git-remote-hg
parentremote-hg: avoid buggy strftime() (diff)
downloadtgif-0c0ebc1fdf57c3ac968e1afdadbc17b9010da6fa.tar.xz
remote-helpers: add extra safety checks
Suggested-by: Roman Ovchinnikov <coolthecold@gmail.com> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/remote-helpers/git-remote-hg')
-rwxr-xr-xcontrib/remote-helpers/git-remote-hg14
1 files changed, 10 insertions, 4 deletions
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index 3cd964dd2d..852fdcf517 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -1164,6 +1164,16 @@ def main(args):
global dry_run
global notes, alias
+ marks = None
+ is_tmp = False
+ gitdir = os.environ.get('GIT_DIR', None)
+
+ if len(args) < 3:
+ die('Not enough arguments.')
+
+ if not gitdir:
+ die('GIT_DIR not set')
+
alias = args[1]
url = args[2]
peer = None
@@ -1184,16 +1194,12 @@ def main(args):
if alias[4:] == url:
is_tmp = True
alias = hashlib.sha1(alias).hexdigest()
- else:
- is_tmp = False
- gitdir = os.environ['GIT_DIR']
dirname = os.path.join(gitdir, 'hg', alias)
branches = {}
bmarks = {}
blob_marks = {}
parsed_refs = {}
- marks = None
parsed_tags = {}
filenodes = {}
fake_bmark = None