Skip to content

feat: add safety warning#35

Open
shatrughantwt wants to merge 2 commits intomasterfrom
feat-add-safety-warning
Open

feat: add safety warning#35
shatrughantwt wants to merge 2 commits intomasterfrom
feat-add-safety-warning

Conversation

@shatrughantwt
Copy link
Contributor

Fixes #34

What this PR does

This PR adds a safety confirmation step before initializing a git repository using gitx -i/--init.

When the command is run from potentially sensitive locations (such as /, $HOME, or /tmp), the user is warned and asked to explicitly confirm before proceeding. This helps prevent accidental repository initialization in unintended directories.

Behavior

  • gitx

    • Errors out if no git repository exists and suggests using -i/--init.
  • gitx -i/--init

    • Shows a safety warning in sensitive directories and asks for confirmation.
    • Aborts if the user does not confirm.
    • Proceeds with initialization and opens the TUI on confirmation.

Notes

  • The safety check only applies when using the -i/--init flag.
  • No change in behavior for normal project directories.
  • The TUI startup flow remains unchanged and runs only after successful initialization.

Please let me know if you’d like the warning scope or behavior adjusted.

Signed-off-by: shatrughan mishra <shatrughanm485@gmail.com>
@shatrughantwt shatrughantwt requested a review from bakayu February 7, 2026 09:53
@bakayu bakayu added enhancement New feature or request language/go Requires the knowledge of "Go" and removed enhancement New feature or request language/go Requires the knowledge of "Go" labels Feb 7, 2026
Signed-off-by: shatrughan mishra <shatrughanm485@gmail.com>
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.

feat: add safety warning before initializing a git repository

2 participants