Title: Add way to get only topmost untracked folders/files · gitpython-developers/GitPython · Discussion #1150 · GitHub
Open Graph Title: Add way to get only topmost untracked folders/files · gitpython-developers/GitPython · Discussion #1150
X Title: Add way to get only topmost untracked folders/files · gitpython-developers/GitPython · Discussion #1150
Description: Add way to get only topmost untracked folders/files
Open Graph Description: Let's say I have a new folder with three new files in it. When I use git status it will show like this: MyProject/New Folder/ But when I use GitPython's repo.untracked_files it will show like this:...
X Description: Let's say I have a new folder with three new files in it. When I use git status it will show like this: MyProject/New Folder/ But when I use GitPython's repo.untracked_files it will show li...
Opengraph URL: https://github.com/gitpython-developers/GitPython/discussions/1150
X: @github
Domain: user:token@github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Add way to get only topmost untracked folders/files","text":"\u003cp dir=\"auto\"\u003eLet's say I have a new folder with three new files in it.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWhen I use \u003ccode class=\"notranslate\"\u003egit status\u003c/code\u003e it will show like this:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"MyProject/New Folder/\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode class=\"notranslate\"\u003eMyProject/New Folder/\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBut when I use GitPython's \u003ccode class=\"notranslate\"\u003erepo.untracked_files\u003c/code\u003e it will show like this:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"MyProject/New Folder/file_a.txt\nMyProject/New Folder/file_b.txt\nMyProject/New Folder/file_c.txt\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode class=\"notranslate\"\u003eMyProject/New Folder/file_a.txt\nMyProject/New Folder/file_b.txt\nMyProject/New Folder/file_c.txt\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIs there a way to get the same result as the \u003ccode class=\"notranslate\"\u003egit status\u003c/code\u003e version?\u003c/p\u003e","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"\u003cp dir=\"auto\"\u003eHello, thanks for the response.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eFor the time being I Implemented a workaround that calls git directly.\u003cbr\u003e\nI am not sure if this is useful for you, but here is the code:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"import subprocess\ncommand = [\u0026quot;git\u0026quot;, \u0026quot;ls-files\u0026quot;, \u0026quot;--others\u0026quot;, \u0026quot;--directory\u0026quot;, \u0026quot;--exclude-standard\u0026quot;, \u0026quot;--no-empty-directory\u0026quot;]\nprocess = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\nuntracked_files_and_folders = [u.decode().strip() for u in process.stdout]\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode class=\"notranslate\"\u003eimport subprocess\ncommand = [\"git\", \"ls-files\", \"--others\", \"--directory\", \"--exclude-standard\", \"--no-empty-directory\"]\nprocess = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\nuntracked_files_and_folders = [u.decode().strip() for u in process.stdout]\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e","upvoteCount":2,"url":"https://github.com/gitpython-developers/GitPython/discussions/1150#discussioncomment-408802"}}}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/discussions/:number(.:format) |
| route-controller | discussions |
| route-action | show |
| fetch-nonce | v2:6ab7bf47-5727-a552-67bb-486ace528bf7 |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | B866:130DD7:F96541:14E4214:6B065492 |
| html-safe-nonce | 0de11c08f75f13ce9d83fa434bec63f1929ba7e5102b9ffc2553a22034f93227 |
| visitor-payload | eyJyZWZlcnJlciI6bnVsbCwicmVxdWVzdF9pZCI6IkI4NjY6MTMwREQ3OkY5NjU0MToxNEU0MjE0OjZCMDY1NDkyIiwidmlzaXRvcl9pZCI6IjEyNDkxNjQ1NDY2MTU0MzIzMzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJjZW50cmFsdXMifQ== |
| visitor-hmac | 69c036f20b08beff9e20f037bf5e828fdc765cdd898015bae81d11de2d9b7b35 |
| hovercard-subject-tag | discussion:3242088 |
| github-keyboard-shortcuts | repository,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/gitpython-developers/GitPython/discussions/1150 |
| twitter:image | https://opengraph.githubassets.com/cb0bbe79950a7a4dd6adbe711e1f5cb74ee7aada0473d5bc949abe4c961bebd5/gitpython-developers/GitPython/discussions/1150 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cb0bbe79950a7a4dd6adbe711e1f5cb74ee7aada0473d5bc949abe4c961bebd5/gitpython-developers/GitPython/discussions/1150 |
| og:image:alt | Let's say I have a new folder with three new files in it. When I use git status it will show like this: MyProject/New Folder/ But when I use GitPython's repo.untracked_files it will show like this:... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6324e6ac990fb6befbec840cc0e102a1071c339bfe8f9826bb12de2e3ba1d297 |
| turbo-cache-control | no-preview |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7f0aa75f4141d440c6110dc31af7ea7797abb6c4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width