diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-09-29 02:38:18 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-10-01 11:03:18 +0200 |
commit | 28a3d2ea3003d2fcabdfff209db945ad9ec86f87 (patch) | |
tree | 7ee277bad9894a7c3da2fa28f9f0b5c3d6e4d9c9 /script | |
parent | b77bcea3525df6360a3a409b3145037e269975aa (diff) | |
download | samba-28a3d2ea3003d2fcabdfff209db945ad9ec86f87.tar.gz samba-28a3d2ea3003d2fcabdfff209db945ad9ec86f87.tar.bz2 samba-28a3d2ea3003d2fcabdfff209db945ad9ec86f87.zip |
autobuild: Simplify find_git_root.
Diffstat (limited to 'script')
-rwxr-xr-x | script/autobuild.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/script/autobuild.py b/script/autobuild.py index 6f14845334..246eaf7fe8 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -241,19 +241,14 @@ def cleanup(): def find_git_root(): '''get to the top of the git repo''' - cwd=os.getcwd() - while os.getcwd() != '/': - try: - os.stat(".git") - ret = os.getcwd() - os.chdir(cwd) - return ret - except: - os.chdir("..") - pass - os.chdir(cwd) + p=os.getcwd() + while p != '/': + if os.path.isdir(os.path.join(p, ".git")): + return p + p = os.path.abspath(os.path.join(p, '..')) return None + def rebase_tree(url): print("Rebasing on %s" % url) run_cmd("git remote add -t master master %s" % url, show=True, dir=test_master) |