Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconcile `dir_exists()` and `is_directory()` #230

Open
dscho opened this issue May 28, 2019 · 2 comments

Comments

@dscho
Copy link
Member

commented May 28, 2019

In https://github.com/git/git/blob/v2.22.0-rc1/builtin/clone.c#L885-L889, there is a function with the short and sweet name dir_exists() (which is the obvious companion to file_exists()). However, it is marked as static, so nobody can use it outside builtin/clone.c.

There is also is_directory() which obviously tries to do the very same, but it uses a name that few developers will think of when they see file_exists() and look for the equivalent function to see whether a given directory exists.

Let's reconcile these, probably by renaming is_directory() to dir_exists() and using it also in builtin/clone.c.

@r1walz

This comment has been minimized.

Copy link

commented May 28, 2019

Let's reconcile these, probably by renaming is_directory() to dir_exists() and using it also in builtin/clone.c.

Maybe moving it to dir.c and renaming in builtin/clone.c?

@dscho

This comment has been minimized.

Copy link
Member Author

commented May 29, 2019

Maybe moving it to dir.c and renaming in builtin/clone.c?

I don't think so, as the current dir_exists() does not verify that the path refers to a directory. In essence, it actually does more of a path_exists().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.