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: redirect.github.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 | /:user_id/:repository/discussions/:number(.:format) |
| route-controller | discussions |
| route-action | show |
| fetch-nonce | v2:090244db-d044-fcf5-65fd-18980889f048 |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | BE4A:7B371:DF691:12EDE9:69696632 |
| html-safe-nonce | 03aa2e955b3e82370bf5714873e56aa5f8c9e7889f177cb76c8c98222b53f9e3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRTRBOjdCMzcxOkRGNjkxOjEyRURFOTo2OTY5NjYzMiIsInZpc2l0b3JfaWQiOiI1Mzc1ODIzNDI1ODU2NjkzODExIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3c940f81a41b27ae42ed9f6765bad8526e49c847ad4e7c99fbcc9fe88323b41c |
| 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 | c6f193beb8ff08443adc07685d75302ab8aaf0a135f6e251c3ff3112c8deb881 |
| 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 | ec4d88fbe7ed62446d90b0a6d8e6db4248a8f8b8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width