def under_git(dir, filename):
"""Return true if filename in dir is under git control."""
if not spawn.find_executable("git"):
if debug:
print("no git executable found")
return False
FNULL = open(os.devnull, 'w')
p = subprocess.Popen(["git", "ls-files", filename, "--error-unmatch"], cwd=dir, stdout=FNULL, stderr=subprocess.STDOUT)
p.wait()
if debug:
print("p.returncode", p.returncode)
return p.returncode == 0
# Don't replace local with remote if local is under version control.
# It would be better to just test whether the remote is newer than local,
# But raw GitHub URLs don't have the necessary last-modified information.
check-google-java-format.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录