Skip to content

Commit 03cdf7c

Browse files
committed
Debugging utf-8 issue
1 parent cb3a720 commit 03cdf7c

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

.github/workflows/process-git-request.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
2323
# print(f"Working Dir : {working_dir}")
2424
os.chdir(working_dir)
2525
# print(f"pwd : {os.getcwd()}")
26-
git_cmd = f"git log --oneline --no-abbrev-commit origin/{target_branch}..origin/{source_branch}"
27-
# print(git_cmd)
26+
git_cmd = f"git log --oneline --no-abbrev-commit " + target_branch + ".." + source_branch
27+
print(f"git command is {git_cmd}")
2828
loglines_to_check = 13
2929
try:
3030
out, err = subprocess.Popen(git_cmd, shell=True, stdout=subprocess.PIPE,
@@ -46,7 +46,7 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
4646
y = x.split()
4747
print(f"This is y {y}")
4848
commit_sha = str(y[0])
49-
print("Found a commit in line ", commit_sha)
49+
print(f"Found a commit in line ", commit_sha)
5050

5151
git_cmd = "git show " + commit_sha
5252
gitlog_out, gitlog_err = subprocess.Popen(git_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).communicate()
@@ -58,7 +58,7 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
5858
upstream_diff = False
5959

6060
for logline in loglines:
61-
print(f"Processing logline {commit_sh}")
61+
print(f"Processing logline {commit_sha}")
6262
lines_counted += 1
6363
if lines_counted == 1:
6464
file.write("Merge Request sha: " + local_diffdiff_sha)
@@ -81,7 +81,7 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
8181
if "commit" in logline.lower():
8282
commit_sha = re.search(r'[0-9a-f]{40}', logline)
8383
upstream_diffdiff_sha = str(commit_sha.group(0)) if commit_sha else ""
84-
print("Upstream : " + upstream_diffdiff_sha)
84+
print(f"Upstream : " + upstream_diffdiff_sha)
8585
if upstream_diffdiff_sha:
8686
file.write("\tUpstream sha: " + upstream_diffdiff_sha)
8787
file.write("\n")
@@ -99,10 +99,12 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
9999
diff_status = process.returncode
100100

101101
if diff_status != 0 and not upstream_diff:
102-
print("diffdiff out: " + diff_out)
103-
print("diffdiff err: " + diff_err)
102+
print(f"diffdiff out: " + diff_out)
103+
print(f"diffdiff err: " + diff_err)
104104
retcode = 1
105105
file.write("error:\nCommit: " + local_diffdiff_sha + " differs with no upstream tag in commit message\n")
106+
except Exception as error:
107+
print(f"Exception in git log command error {error}")
106108

107109
finally:
108110
file.close()
@@ -128,7 +130,7 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
128130
# print("pull request is " + pullreq)
129131
requestor = str(argv_in[4])
130132

131-
retcode = process_git_request(fname, target_branch, source_branch, prj_dir)
133+
retcode = process_git_request(fname, target_branch, pullreq, prj_dir)
132134

133135
if retcode != 0:
134136
with open(fname, 'r') as fd:

.github/workflows/process-pull-request.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jobs:
3535
if ! git fetch origin ${{ github.head_ref }}; then
3636
echo "Unable to checkout ${{ github.head_ref }}"
3737
fi
38-
git remote add linux https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
39-
git fetch --shallow-since="3 years ago" linux
38+
# git remote add linux https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
39+
# git fetch --shallow-since="3 years ago" linux
4040
echo "Will run process-git-request.py with:"
4141
echo "fname = ${{ github.run_id }}"
4242
echo "target_branch = ${{ github.base_ref }}"

0 commit comments

Comments
 (0)