Skip to content

Conversation

@Divy13ansh
Copy link
Contributor

What this PR does

  • Adds a check at startup to ensure gitx only runs inside a Git repository.
  • If run outside a repo, prints "Error: not a git repository." and exits with code 1.

Screenshots

Outside a Git repository

Screenshot 2025-10-02 193119

Inside a Git repository

Works normally
Screenshot 2025-10-02 193338

Fixes #22

@bakayu
Copy link
Member

bakayu commented Oct 2, 2025

The CI pipeline failed-

Error: cmd/gitx/main.go:36:10: ST1005: error strings should not be capitalized (staticcheck)
  		return fmt.Errorf("Error: not a git repository")
  		       ^
  1 issues:
  * staticcheck: 1
  
  Error: issues found

Edit: It was for a previous commit, the latest commit fixes this. Please ignore this!

@bakayu bakayu merged commit 3d9482c into gitxtui:master Oct 2, 2025
2 checks passed
@bakayu bakayu added the hacktoberfest-accepted This PR is accepted under the hacktoberfest challenge label Oct 2, 2025
@bakayu
Copy link
Member

bakayu commented Oct 2, 2025

Thank you for the contribution!

whynotdeep7 pushed a commit to whynotdeep7/gitx that referenced this pull request Oct 2, 2025
Co-authored-by: Ayush Chauhan <56398566+bakayu@users.noreply.github.com>
@Divy13ansh Divy13ansh deleted the feat/restrict-run-to-git-repo branch October 4, 2025 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted This PR is accepted under the hacktoberfest challenge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] - Restrict to Git Repositories

2 participants