I'm trying to develop a Gatekeeping script in python rollin.py
with the following requirements:
Assume user would launch the rollin.py
script from anywhere within his local git cloned area to push his commits to the master repo
Now, rollin.py
script would
- clone a repo from master
- pull user commits and merges into the cloned repo
- Run the compliance tests
- If passes, then push those changes to master repo else discard and notify the user
Now within rolloin.py
script, how would I check the the repo name and user's git clone path? (since user can launch the rolloin.py
script from anywhere in his local area)
Is there any existing function or method available? otherwise I'm thinking to implement reverse recursive search from cwd
to locate the .git and and then url from it's config file.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…