{"action":"created","comment":{"url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/pulls/comments/171224466","pull_request_review_id":100038097,"id":171224466,"diff_hunk":"@@ -21,14 +22,25 @@ SPACESHIP_DIR_COLOR=\"${SPACESHIP_DIR_COLOR=\"cyan\"}\"\n spaceship_dir() {\n   [[ $SPACESHIP_DIR_SHOW == false ]] && return\n \n-  local dir\n+  local dir trunc_prefix\n \n   # Threat repo root as a top-level directory or not\n   if [[ $SPACESHIP_DIR_TRUNC_REPO == true ]] && spaceship::is_git; then\n     local git_root=$(git rev-parse --show-toplevel)\n-    dir=\"$git_root:t${$(expr $(pwd) : \"$git_root\\(.*\\)\")}\"\n+\n+    if [[ $git_root:h == / ]]; then\n+      trunc_prefix=/","path":"sections/dir.zsh","position":21,"original_position":21,"commit_id":"c2b4400691e199e3afcc95eebf08ec0cd2a1bde6","original_commit_id":"c2b4400691e199e3afcc95eebf08ec0cd2a1bde6","user":{"login":"salmanulfarzy","id":10276208,"avatar_url":"https://avatars0.githubusercontent.com/u/10276208?v=4","gravatar_id":"","url":"https://api.github.com/users/salmanulfarzy","html_url":"https://github.com/salmanulfarzy","followers_url":"https://api.github.com/users/salmanulfarzy/followers","following_url":"https://api.github.com/users/salmanulfarzy/following{/other_user}","gists_url":"https://api.github.com/users/salmanulfarzy/gists{/gist_id}","starred_url":"https://api.github.com/users/salmanulfarzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salmanulfarzy/subscriptions","organizations_url":"https://api.github.com/users/salmanulfarzy/orgs","repos_url":"https://api.github.com/users/salmanulfarzy/repos","events_url":"https://api.github.com/users/salmanulfarzy/events{/privacy}","received_events_url":"https://api.github.com/users/salmanulfarzy/received_events","type":"User","site_admin":false},"body":"If I understand correctly, This checks whether the `git_root` is `/`, Right ? But why would someone keep `/` under `git` !! 😕 ","created_at":"2018-02-28T12:08:15Z","updated_at":"2018-02-28T12:16:28Z","html_url":"https://github.com/denysdovhan/spaceship-prompt/pull/281#discussion_r171224466","pull_request_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/pulls/281","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/denysdovhan/spaceship-prompt/pulls/comments/171224466"},"html":{"href":"https://github.com/denysdovhan/spaceship-prompt/pull/281#discussion_r171224466"},"pull_request":{"href":"https://api.github.com/repos/denysdovhan/spaceship-prompt/pulls/281"}}},"pull_request":{"url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/pulls/281","id":158601628,"html_url":"https://github.com/denysdovhan/spaceship-prompt/pull/281","diff_url":"https://github.com/denysdovhan/spaceship-prompt/pull/281.diff","patch_url":"https://github.com/denysdovhan/spaceship-prompt/pull/281.patch","issue_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/issues/281","number":281,"state":"open","locked":false,"title":"Add SPACESHIP_DIR_TRUNC_PREFIX, a prefix before cwd when truncated","user":{"login":"segevfiner","id":24731903,"avatar_url":"https://avatars0.githubusercontent.com/u/24731903?v=4","gravatar_id":"","url":"https://api.github.com/users/segevfiner","html_url":"https://github.com/segevfiner","followers_url":"https://api.github.com/users/segevfiner/followers","following_url":"https://api.github.com/users/segevfiner/following{/other_user}","gists_url":"https://api.github.com/users/segevfiner/gists{/gist_id}","starred_url":"https://api.github.com/users/segevfiner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/segevfiner/subscriptions","organizations_url":"https://api.github.com/users/segevfiner/orgs","repos_url":"https://api.github.com/users/segevfiner/repos","events_url":"https://api.github.com/users/segevfiner/events{/privacy}","received_events_url":"https://api.github.com/users/segevfiner/received_events","type":"User","site_admin":false},"body":"A version of #280 for the 3.0 branch\r\n\r\nWhen the cwd is truncated by `SPACESHIP_DIR_TRUNC` instead of showing:\r\n\r\n    a/b/c\r\n\r\nIt will show:\r\n\r\n    .../a/b/c\r\n\r\nThe prefix is configurable of course and can be disabled by setting it to an empty string.\r\n\r\nI also modified `SPACESHIP_DIR_TRUNC_REPO` to use `SPACESHIP_DIR_TRUNC_PREFIX` and made it not truncate for a repository that is below the root directory. In addition, I optimized its code to use Zsh constructs instead of command substitutions.\r\n\r\n![image](https://user-images.githubusercontent.com/24731903/34009693-88370b94-e112-11e7-9d0f-1d3b95a9b8a0.png)\r\n\r\ncc @maximbaz ","created_at":"2017-12-15T13:20:35Z","updated_at":"2018-02-28T12:16:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00029bd1513460a2027fd5e9caa44790f5b5523f","assignee":{"login":"segevfiner","id":24731903,"avatar_url":"https://avatars0.githubusercontent.com/u/24731903?v=4","gravatar_id":"","url":"https://api.github.com/users/segevfiner","html_url":"https://github.com/segevfiner","followers_url":"https://api.github.com/users/segevfiner/followers","following_url":"https://api.github.com/users/segevfiner/following{/other_user}","gists_url":"https://api.github.com/users/segevfiner/gists{/gist_id}","starred_url":"https://api.github.com/users/segevfiner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/segevfiner/subscriptions","organizations_url":"https://api.github.com/users/segevfiner/orgs","repos_url":"https://api.github.com/users/segevfiner/repos","events_url":"https://api.github.com/users/segevfiner/events{/privacy}","received_events_url":"https://api.github.com/users/segevfiner/received_events","type":"User","site_admin":false},"assignees":[{"login":"segevfiner","id":24731903,"avatar_url":"https://avatars0.githubusercontent.com/u/24731903?v=4","gravatar_id":"","url":"https://api.github.com/users/segevfiner","html_url":"https://github.com/segevfiner","followers_url":"https://api.github.com/users/segevfiner/followers","following_url":"https://api.github.com/users/segevfiner/following{/other_user}","gists_url":"https://api.github.com/users/segevfiner/gists{/gist_id}","starred_url":"https://api.github.com/users/segevfiner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/segevfiner/subscriptions","organizations_url":"https://api.github.com/users/segevfiner/orgs","repos_url":"https://api.github.com/users/segevfiner/repos","events_url":"https://api.github.com/users/segevfiner/events{/privacy}","received_events_url":"https://api.github.com/users/segevfiner/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":318998655,"url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/labels/new-feature","name":"new-feature","color":"1d76db","default":false},{"id":575304421,"url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/labels/proposal","name":"proposal","color":"a4ea72","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/pulls/281/commits","review_comments_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/pulls/281/comments","review_comment_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/issues/281/comments","statuses_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/statuses/c2b4400691e199e3afcc95eebf08ec0cd2a1bde6","head":{"label":"segevfiner:dir-trunc-prefix-3.0","ref":"dir-trunc-prefix-3.0","sha":"c2b4400691e199e3afcc95eebf08ec0cd2a1bde6","user":{"login":"segevfiner","id":24731903,"avatar_url":"https://avatars0.githubusercontent.com/u/24731903?v=4","gravatar_id":"","url":"https://api.github.com/users/segevfiner","html_url":"https://github.com/segevfiner","followers_url":"https://api.github.com/users/segevfiner/followers","following_url":"https://api.github.com/users/segevfiner/following{/other_user}","gists_url":"https://api.github.com/users/segevfiner/gists{/gist_id}","starred_url":"https://api.github.com/users/segevfiner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/segevfiner/subscriptions","organizations_url":"https://api.github.com/users/segevfiner/orgs","repos_url":"https://api.github.com/users/segevfiner/repos","events_url":"https://api.github.com/users/segevfiner/events{/privacy}","received_events_url":"https://api.github.com/users/segevfiner/received_events","type":"User","site_admin":false},"repo":{"id":114285833,"name":"spaceship-prompt","full_name":"segevfiner/spaceship-prompt","owner":{"login":"segevfiner","id":24731903,"avatar_url":"https://avatars0.githubusercontent.com/u/24731903?v=4","gravatar_id":"","url":"https://api.github.com/users/segevfiner","html_url":"https://github.com/segevfiner","followers_url":"https://api.github.com/users/segevfiner/followers","following_url":"https://api.github.com/users/segevfiner/following{/other_user}","gists_url":"https://api.github.com/users/segevfiner/gists{/gist_id}","starred_url":"https://api.github.com/users/segevfiner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/segevfiner/subscriptions","organizations_url":"https://api.github.com/users/segevfiner/orgs","repos_url":"https://api.github.com/users/segevfiner/repos","events_url":"https://api.github.com/users/segevfiner/events{/privacy}","received_events_url":"https://api.github.com/users/segevfiner/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/segevfiner/spaceship-prompt","description":":star: :rocket: An “Oh My ZSH!” theme for Astronauts.","fork":true,"url":"https://api.github.com/repos/segevfiner/spaceship-prompt","forks_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/forks","keys_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/teams","hooks_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/hooks","issue_events_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/issues/events{/number}","events_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/events","assignees_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/assignees{/user}","branches_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/branches{/branch}","tags_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/tags","blobs_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/git/refs{/sha}","trees_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/statuses/{sha}","languages_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/languages","stargazers_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/stargazers","contributors_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/contributors","subscribers_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/subscribers","subscription_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/subscription","commits_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/commits{/sha}","git_commits_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/git/commits{/sha}","comments_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/comments{/number}","issue_comment_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/issues/comments{/number}","contents_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/contents/{+path}","compare_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/merges","archive_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/downloads","issues_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/issues{/number}","pulls_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/pulls{/number}","milestones_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/milestones{/number}","notifications_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/labels{/name}","releases_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/releases{/id}","deployments_url":"https://api.github.com/repos/segevfiner/spaceship-prompt/deployments","created_at":"2017-12-14T18:57:55Z","updated_at":"2018-01-19T13:09:57Z","pushed_at":"2018-02-27T18:39:10Z","git_url":"git://github.com/segevfiner/spaceship-prompt.git","ssh_url":"git@github.com:segevfiner/spaceship-prompt.git","clone_url":"https://github.com/segevfiner/spaceship-prompt.git","svn_url":"https://github.com/segevfiner/spaceship-prompt","homepage":"https://git.io/spaceship","size":6156,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"denysdovhan:master","ref":"master","sha":"b29a3c084dd34be50a59cb4fb2687fdf39dd46cf","user":{"login":"denysdovhan","id":3459374,"avatar_url":"https://avatars1.githubusercontent.com/u/3459374?v=4","gravatar_id":"","url":"https://api.github.com/users/denysdovhan","html_url":"https://github.com/denysdovhan","followers_url":"https://api.github.com/users/denysdovhan/followers","following_url":"https://api.github.com/users/denysdovhan/following{/other_user}","gists_url":"https://api.github.com/users/denysdovhan/gists{/gist_id}","starred_url":"https://api.github.com/users/denysdovhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denysdovhan/subscriptions","organizations_url":"https://api.github.com/users/denysdovhan/orgs","repos_url":"https://api.github.com/users/denysdovhan/repos","events_url":"https://api.github.com/users/denysdovhan/events{/privacy}","received_events_url":"https://api.github.com/users/denysdovhan/received_events","type":"User","site_admin":false},"repo":{"id":50726688,"name":"spaceship-prompt","full_name":"denysdovhan/spaceship-prompt","owner":{"login":"denysdovhan","id":3459374,"avatar_url":"https://avatars1.githubusercontent.com/u/3459374?v=4","gravatar_id":"","url":"https://api.github.com/users/denysdovhan","html_url":"https://github.com/denysdovhan","followers_url":"https://api.github.com/users/denysdovhan/followers","following_url":"https://api.github.com/users/denysdovhan/following{/other_user}","gists_url":"https://api.github.com/users/denysdovhan/gists{/gist_id}","starred_url":"https://api.github.com/users/denysdovhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denysdovhan/subscriptions","organizations_url":"https://api.github.com/users/denysdovhan/orgs","repos_url":"https://api.github.com/users/denysdovhan/repos","events_url":"https://api.github.com/users/denysdovhan/events{/privacy}","received_events_url":"https://api.github.com/users/denysdovhan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/denysdovhan/spaceship-prompt","description":":rocket::star: A Zsh prompt for Astronauts","fork":false,"url":"https://api.github.com/repos/denysdovhan/spaceship-prompt","forks_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/forks","keys_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/teams","hooks_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/hooks","issue_events_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/issues/events{/number}","events_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/events","assignees_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/assignees{/user}","branches_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/branches{/branch}","tags_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/tags","blobs_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/git/refs{/sha}","trees_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/statuses/{sha}","languages_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/languages","stargazers_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/stargazers","contributors_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/contributors","subscribers_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/subscribers","subscription_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/subscription","commits_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/commits{/sha}","git_commits_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/git/commits{/sha}","comments_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/comments{/number}","issue_comment_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/issues/comments{/number}","contents_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/contents/{+path}","compare_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/merges","archive_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/downloads","issues_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/issues{/number}","pulls_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/pulls{/number}","milestones_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/milestones{/number}","notifications_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/labels{/name}","releases_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/releases{/id}","deployments_url":"https://api.github.com/repos/denysdovhan/spaceship-prompt/deployments","created_at":"2016-01-30T13:50:02Z","updated_at":"2018-02-28T10:24:09Z","pushed_at":"2018-02-27T18:39:11Z","git_url":"git://github.com/denysdovhan/spaceship-prompt.git","ssh_url":"git@github.com:denysdovhan/spaceship-prompt.git","clone_url":"https://github.com/denysdovhan/spaceship-prompt.git","svn_url":"https://github.com/denysdovhan/spaceship-prompt","homepage":"https://denysdovhan.com/spaceship-prompt/","size":6900,"stargazers_count":2911,"watchers_count":2911,"language":"Shell","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":230,"mirror_url":null,"archived":false,"open_issues_count":44,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":230,"open_issues":44,"watchers":2911,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/denysdovhan/spaceship-prompt/pulls/281"},"html":{"href":"https://github.com/denysdovhan/spaceship-prompt/pull/281"},"issue":{"href":"https://api.github.com/repos/denysdovhan/spaceship-prompt/issues/281"},"comments":{"href":"https://api.github.com/repos/denysdovhan/spaceship-prompt/issues/281/comments"},"review_comments":{"href":"https://api.github.com/repos/denysdovhan/spaceship-prompt/pulls/281/comments"},"review_comment":{"href":"https://api.github.com/repos/denysdovhan/spaceship-prompt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/denysdovhan/spaceship-prompt/pulls/281/commits"},"statuses":{"href":"https://api.github.com/repos/denysdovhan/spaceship-prompt/statuses/c2b4400691e199e3afcc95eebf08ec0cd2a1bde6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"salmanulfarzy"}}