Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 72e9edf

Browse files
fix: fixed remote/branch fetching
1 parent ed9b38d commit 72e9edf

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

‎Github-Automation/repoInfo.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
1+
import subprocess
12
import os
23
mypath = os.getcwd()
34
infofile = mypath + '/.git/config'
45

6+
57
def takeInfo():
68
print('No Existing repo info found\n')
79
url = str(input('Enter the Github Repo URL: '))
810
branch = str(input('Enter the branch: '))
9-
info = ['n', url, branch]
11+
info = ['n', url, branch]
1012
return info
1113

14+
1215
def checkinfoInDir():
1316
if (os.path.exists(infofile)):
14-
print('Repo Info Found:-')
15-
with open(infofile, "r") as f:
16-
info = f.readlines()
17-
# print(info)
18-
for ele in info:
19-
if('url' in ele):
20-
url = info[info.index(ele)].split()[2]
17+
url = subprocess.Popen('git config --get remote.origin.url',
18+
stdout=subprocess.PIPE).stdout.read().decode('utf-8')
2119

22-
if('branch' in ele):
23-
branch = info[info.index(ele)].split()[1].split('"')[1]
24-
info = [url , branch]
20+
branch = subprocess.Popen('git rev-parse --symbolic-full-name HEAD',
21+
stdout=subprocess.PIPE).stdout.read().decode('utf-8')
22+
23+
url, branch = url.split('\n')[0], branch.split('\n')[0].split('/')[2]
24+
info = [url, branch]
2525
else:
2626
info = takeInfo()
2727
return info
28-
29-
print(checkinfoInDir())

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /