------------------------------------------------------------------------------
To reply, visit https://hellosplat.com/s/beanbag/tickets/4953/
------------------------------------------------------------------------------

New ticket #4953 by barbreviewbug
For Beanbag, Inc. > RBTools

Status: New
Tags: Priority:Medium, Type:Defect


------------------------------------------------------------------------------
Submitting reviews in some directories fails due to none error
==============================================================================

# What version are you running?
RBTools 2.0.1 (Python 3.9.2)


# What steps will reproduce the problem?
This is happening randomly in a repository I'm using so not something someone 
can reproduce on command, however for my repo to reproduce it I simply add a 
file, commit it, and use rbt post

# What is the expected output? What do you see instead?
For it to post to our RB server, instead I get:
CRITICAL: expected str, bytes or os.PathLike object, not NoneType
This seems to be from the
['git', 'rev-parse', '--git-dir']
function, it returns .git, there is a bit of code checking that the folder 
exists and, if it doesn't, returns none, which the script cannot then handle. 
However, this check is invalid because the repo is at path ~/REPO/modules/new 
and the folder I am in is ~/REPO/modules/new/tests/test/build so there would 
not be a .git folder in this path, it should be looking for a .git folder up 3 
directories.
Note that I have many branches, I am currently in a non-main branch with a 
remote that points to upstram main (I have many branches that do this in this 
repository)

# What operating system are you using?
Linux, debian 11

# Attach the debug out from the command.

```
>>> RBTools 2.0.1
>>> Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110]
>>> Running on Linux-5.15.0-11.1-liquorix-amd64-x86_64-with-glibc2.32
>>> Home = /home/user
>>> Current directory = /home/user/REPO/modules/new/tests/test/_AA
>>> Command line: rbt post --branch=devfix --target-groups=CP_Modules 
>>> --bugs-closed=20667 -d
>>> Running: tf vc help
>>> Checking for a Bazaar repository...
>>> Unable to execute "brz help" or "bzr help": skipping Bazaar
>>> Checking for a ClearCase repository...
>>> Unable to execute "cleartool help": skipping ClearCase
>>> Checking for a CVS repository...
>>> Unable to execute "cvs": skipping CVS
>>> Checking for a Git repository...
['git', 'rev-parse', '--git-dir']
None
>>> Running: git rev-parse --git-dir
>>> Running: git config core.bare
>>> Running: git rev-parse --show-toplevel
['git', 'symbolic-ref', '-q', 'HEAD']
/home/user/REPO/modules/new
>>> Running: git symbolic-ref -q HEAD
['git', 'config', '--get', 'branch.devfix.merge']
/home/user/REPO/modules/new
>>> Running: git config --get branch.devfix.merge
>>> Command exited with rc 1: ['git', 'config', '--get', 'branch.devfix.merge']
---
['git', 'config', '--get', 'branch.devfix.remote']
/home/user/REPO/modules/new
>>> Running: git config --get branch.devfix.remote
>>> Command exited with rc 1: ['git', 'config', '--get', 'branch.devfix.remote']
---
['git', 'config', '--global', '--get', 'init.defaultBranch']
/home/user/REPO/modules/new
>>> Running: git config --global --get init.defaultBranch
['git', 'rev-parse', '--git-dir']
/home/user/REPO/modules/new
>>> Running: git rev-parse --git-dir
.git
None
['git', 'rev-parse', '--git-dir']
/home/user/REPO/modules/new
>>> Running: git rev-parse --git-dir
.git
Traceback (most recent call last):
  File "/home/user/.local/bin/rbt", line 39, in <module>
    sys.exit(main())
  File 
"/home/user/.local/lib/python3.9/site-packages/rbtools/commands/main.py", line 
124, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File 
"/home/user/.local/lib/python3.9/site-packages/rbtools/commands/__init__.py", 
line 770, in run_from_argv
    exit_code = self.main(*args) or 0
  File 
"/home/user/.local/lib/python3.9/site-packages/rbtools/commands/post.py", line 
956, in main
    repository_info, self.tool = self.initialize_scm_tool(
  File 
"/home/user/.local/lib/python3.9/site-packages/rbtools/commands/__init__.py", 
line 816, in initialize_scm_tool
    repository_info, tool = scan_usable_client(
  File 
"/home/user/.local/lib/python3.9/site-packages/rbtools/clients/__init__.py", 
line 861, in scan_usable_client
    repository_info = tool.get_repository_info()
  File "/home/user/.local/lib/python3.9/site-packages/rbtools/clients/git.py", 
line 378, in get_repository_info
    upstream_branch = self._get_parent_branch()
  File "/home/user/.local/lib/python3.9/site-packages/rbtools/clients/git.py", 
line 568, in _get_parent_branch
    os.path.exists(os.path.join(self._get_git_dir(), 'refs',
  File "/usr/lib/python3.9/posixpath.py", line 76, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
```
I added some print output to narrow down the issue, which is included in the 
above debug output


------------------------------------------------------------------------------

-- 
You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard-issues+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/reviewboard-issues/20211224114915.27794.87536%40ip-10-1-54-209.ec2.internal.

Reply via email to