Skip to content

fix: replace hardcoded developer git path with dynamic repo root (fixes #111)#136

Open
charlesaurav13 wants to merge 1 commit into
BusKill:masterfrom
charlesaurav13:fix/111-hardcoded-git-path
Open

fix: replace hardcoded developer git path with dynamic repo root (fixes #111)#136
charlesaurav13 wants to merge 1 commit into
BusKill:masterfrom
charlesaurav13:fix/111-hardcoded-git-path

Conversation

@charlesaurav13

Copy link
Copy Markdown

Summary

The upgrade flow contained a hardcoded path to the original developer's local machine:

'--git-dir=/home/user/sandbox/buskill-app/.git'

This caused fatal: not a git repository on every system other than the developer's, crashing the upgrade flow whenever SOURCE_DATE_EPOCH was not set (i.e. in development / testing builds).

Changes

Replace the hardcoded path with one derived dynamically from __file__:

# before
result = subprocess.run( [
 'git',
 '--git-dir=/home/user/sandbox/buskill-app/.git',
 'log', '-1', '--pretty=%ct'
], capture_output = True )

# after
repo_root = os.path.abspath(
 os.path.join( os.path.dirname(__file__), '..', '..', '..' )
)
result = subprocess.run( [
 'git', '-C', repo_root,
 'log', '-1', '--pretty=%ct'
], capture_output = True )

buskill/__init__.py lives at src/packages/buskill/__init__.py, so 3 directories up is always the repo root. Using git -C rather than --git-dir means it works regardless of the current working directory.

Test plan

  • Run upgrade check in a development build (no SOURCE_DATE_EPOCH) — no longer crashes with fatal: not a git repository
  • Verify SOURCE_DATE_EPOCH is correctly populated from git log output

Closes #111

Fixes BusKill#111. The upgrade flow contained a hardcoded path to the
original developer's local machine (/home/user/sandbox/buskill-app/.git)
which fails on every other system with 'fatal: not a git repository'.

Replace it with a path derived dynamically from __file__: since
buskill/__init__.py lives at src/packages/buskill/__init__.py, the
repo root is always 3 directories up. Use 'git -C <repo_root>' so the
command works regardless of the current working directory.

Signed-off-by: charlesaurav13 <sauravp1236@gmail.com>
@github-actions

Copy link
Copy Markdown

INFO: No unicode characters found in PR's commits

(source)

@maltfield

Copy link
Copy Markdown
Member

Thanks for the PR :)

Please note that this repo does not accept contributions that use AI

Can you please tell us if you wrote this code, comments, and PR contents entirely by yourself? Or if you used AI for any part of it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: hardcoded developer git path at /home/user/sandbox/buskill-app/.git crashes upgrade flow

2 participants