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: github-redirect.dependabot.com
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Add way to get only topmost untracked folders/files","text":"Let's say I have a new folder with three new files in it.
\nWhen I use git status it will show like this:
\nMyProject/New Folder/\n
\nBut when I use GitPython's repo.untracked_files it will show like this:
\nMyProject/New Folder/file_a.txt\nMyProject/New Folder/file_b.txt\nMyProject/New Folder/file_c.txt\n
\nIs there a way to get the same result as the git status version?
","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"Hello, thanks for the response.
\nFor the time being I Implemented a workaround that calls git directly.
\nI am not sure if this is useful for you, but here is the code:
\nimport 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
","upvoteCount":2,"url":"https://github.com/gitpython-developers/GitPython/discussions/1150#discussioncomment-408802"}}}
| route-pattern | /_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format) |
| route-controller | voltron_discussions_fragments |
| route-action | discussion_layout |
| fetch-nonce | v2:d60dc15d-acf4-4dcb-05c1-4414b39e3c4b |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | 867E:15DFF5:E3B234:13B263B:696A90F3 |
| html-safe-nonce | 673c7250b27450f825d45ce4f66aaeafe06a2a66ff83cc5bdc768a7463a111b0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NjdFOjE1REZGNTpFM0IyMzQ6MTNCMjYzQjo2OTZBOTBGMyIsInZpc2l0b3JfaWQiOiI4OTg5MTg2ODc2NjM0NzMwNzM5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | bbd67aedee4ee7d6e750c71d94ab00b84ef7870480846f802795419faa67783e |
| 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/_view_fragments/Voltron::DiscussionsFragmentsController/show/gitpython-developers/GitPython/1150/discussion_layout |
| 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 | 4dd496afc954da9c207b2d9fbe86e3074619f565754aa1d9274aec30d9e5b8d7 |
| 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 | 31496a13b80a2f6ad77d6c617ee2255a3545b539 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width