Improve `git-ignore` command by hyperupcall · Pull Request #1047 · tj/git-extras

@hyperupcall

Closes #38

  • git ignore<TAB> now shows file/directory names

Closes #347

  • No longer prints "fatal: not a git repository"-type errors to console. If no (local) Git repository is present, handle gracefully

Closes #427 (stale issue about file that does not exist)

@hyperupcall

spacewander


function show_local {
cd "$(git root)"
maybe_cd_to_git_root

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should warn the user if this cmd doesn't run in git repo.
See #347 (comment)


function maybe_cd_to_git_root {
local result=
if result=$(git rev-parse --show-toplevel 2>/dev/null); then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function show_private {
cd "$(git root)"
maybe_cd_to_git_root
show_contents Private "${GIT_DIR}/info/exclude"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We must require a git repo for setting the private ignorefile. As it's private to the git repo.

@hyperupcall

@hyperupcall

Sorry for the slow reply, I have addressed the feedback

spacewander

vanpipy pushed a commit to vanpipy/git-extras that referenced this pull request

Sep 14, 2023
* Improve `git-ignore` command

* fix: Improve warnings/errors and modify `not_need_git_repo`