Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve git-ignore command #1047

Merged
merged 2 commits into from
Jul 13, 2023
Merged

Conversation

hyperupcall
Copy link
Collaborator

@hyperupcall hyperupcall commented May 17, 2023

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)

bin/git-ignore Outdated
@@ -34,22 +46,22 @@ function add_global {
}

function show_local {
cd "$(git root)"
maybe_cd_to_git_root
Copy link
Collaborator

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)

@@ -11,18 +11,30 @@ function show_contents {
fi
}

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

Choose a reason for hiding this comment

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

add_patterns .gitignore "$@"
}

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

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
Copy link
Collaborator Author

Sorry for the slow reply, I have addressed the feedback

@spacewander spacewander merged commit 0b5d2cc into tj:master Jul 13, 2023
@hyperupcall hyperupcall deleted the better-git-ignore branch July 13, 2023 06:37
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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants