-
-
Notifications
You must be signed in to change notification settings - Fork 964
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
Fix directory truncation inside .git dir #417
Fix directory truncation inside .git dir #417
Conversation
Unfortunately, this doesn't help us identify where the root of a git directory is from within the |
As noted in the description. This will make spaceship consider the .git directory as outside a Git repository so as to revert to normal truncation behavior which is better than a messed up prompt. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue with submodules described on #412 still exists.
Behaviour: Everything other than Is this the intended behaviour @segevfiner ? |
Inside `.git` directories it will truncate to `SPACESHIP_DIR_TRUNC` like
when outside a Git repository. The special Git specific truncation only
applies to Git work spaces. This is since `git rev-parse --show-toplevel`
fails inside the `.git` directory and `git rev-parse --absolute-git-dir`
requires a new Git version and gives bad output for submodules for our use
case.
What this PR does is fix the way we handle the output of `git rev-parse
--is-inside-work-tree`. It is specified to print `true/false` and not
return it's result via an exit code. The fact that it fails outside a Git
repository is probably a bug in Git.
…On Fri, Apr 20, 2018 at 4:59 PM, Salmanul Farzy ***@***.***> wrote:
*Behaviour*: Everything other than git repository directory paths are
truncated to SPACESHIP_DIR_TRUNC.
[image: dir trunc]
<https://user-images.githubusercontent.com/10276208/39054106-615074e6-44ce-11e8-81bd-496b07567564.png>
Is this the intended behaviour @segevfiner <https://github.com/segevfiner>
?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#417 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AXlg_wgFd_NgkZrKFQbM3gtp1UtzMlklks5tqemlgaJpZM4TLnhI>
.
|
e9007d2
to
1614479
Compare
Apparently the behavior of `git rev-parse --is-inside-work-tree` is: 1. If outside any git repo, exit with an error. 2. If inside a git repo, print "true". 3. If inside a git repo but outside the work tree (e.g. git dir), print "false". (The first might actually be a bug...) Fixes spaceship-prompt#388 (again)
1614479
to
39ee77f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Manually tested and tests pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @salmanulfarzy, please, merge if needed.
P.S: Might be better to add a comment with reference to the issue.
* origin/4.0: (44 commits) 3.8.0 Support multiple files for COMPOSE_FILE in docker (spaceship-prompt#395) Add Terraform Workspace section (spaceship-prompt#542) Document kubecontext showing namepace (spaceship-prompt#566) Use Zsh field splitting instead of awk (spaceship-prompt#544) Add namespace to k8s section (spaceship-prompt#565) 3.7.2 Document go.mod detection in golang section Improve package version detection using jq, python and node (spaceship-prompt#441) Truncate .git directory and childs like normal directories (spaceship-prompt#417) Add option to toggle verbose rust version (spaceship-prompt#521) Change font suggestion: Fira Mono → Fira Code Support go.mod files and fix GOPATH matching (spaceship-prompt#559) Hide PR template guidance behind comments (spaceship-prompt#556) Document pyproject.toml in pyenv section (spaceship-prompt#551) 3.7.1 Recognize pyproject.toml when showing pyenv section (spaceship-prompt#550) Fix orderd list count on CONTRIBUTING page (spaceship-prompt#548) Add image in doc for powerline dir lock symbol (spaceship-prompt#517) Remove argument from char test shebang (spaceship-prompt#533) ...
Description
Apparently the behavior of
git rev-parse --is-inside-work-tree
is:(The first might actually be a bug...)
Fixes #388 (again)
Revert PR of the original fix which causes issues: #416
cc @salmanulfarzy