Code

gitview: ls-remote invocation shellquote safety.
authorJunio C Hamano <junkio@cox.net>
Wed, 22 Feb 2006 11:47:20 +0000 (03:47 -0800)
committerJunio C Hamano <junkio@cox.net>
Wed, 22 Feb 2006 11:47:20 +0000 (03:47 -0800)
This will allow you to point GIT_DIR at directories with funny names.

Signed-off-by: Junio C Hamano <junkio@cox.net>
contrib/gitview/gitview

index 5c338c02206869d4e6dadb2d15212532678c6f12..4b52eb7dc76e424a37a21fbf65327d4655e9d8fe 100755 (executable)
@@ -454,11 +454,7 @@ class GitView:
 
                self.bt_sha1 = { }
                ls_remote = re.compile('^(.{40})\trefs/([^^]+)(?:\\^(..))?$');
-               git_dir = os.getenv("GIT_DIR")
-               if (git_dir == None):
-                       git_dir = ".git"
-
-               fp = os.popen('git ls-remote ' + git_dir)
+               fp = os.popen('git ls-remote "${GIT_DIR-.git}"')
                while 1:
                        line = string.strip(fp.readline())
                        if line == '':