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: patch-diff.githubusercontent.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:5b251695-7bab-6998-9d12-cb1ffa753d5c |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | E95A:3AE3D1:569CEAF:71CD8E0:696D8EB8 |
| html-safe-nonce | ccec2edeb07efdfda813f45959a1387c21c92a7c57685c35e155c8db45381099 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTVBOjNBRTNEMTo1NjlDRUFGOjcxQ0Q4RTA6Njk2RDhFQjgiLCJ2aXNpdG9yX2lkIjoiNTk5MzA1NzQxMDgwMjg4MDE4NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6f97e5220615c1324881c46a2aa55fd07fc4ed101822ce9160a29ea184379557 |
| 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 | 4922b452d03cd8dbce479d866a11bc25b59ef6ee2da23aa9b0ddefa6bd4d0064 |
| 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 | 7e5ae23c70136152637ceee8d6faceb35596ec46 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width