Re: [GSoC] [PATCH v2 4/9] dir: libify and export helper functions from clone.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Atharva Raykar <raykar.ath@xxxxxxxxx> writes:

> Naming things is hard...

Absolutely.

> Maybe the right phrase would be 'target directory'? We are creating a
> target directory name by looking at the "humanish" part of the Git URL.
>
> I think the intention of all callers of this function is to get a
> "default" directory name which will be used as the target of some
> operation in the absence of the user providing one.
>
> So maybe the name could be: 'guess_target_dir_from_git_url()'

I have no immediate objection to the name.  

Just to see how people (including you) may react to a name from a
completely different line of thinking, let me throw this, though.

How does git_url_basename() sound?  

Instead of saying what we'd use it for (i.e. as the name for the
directory getting created), we say what we compute.  We take a
URL-looking thing that is used by Git, and we compute something like
basename() but that is tailored for Git (e.g. unlike "basename
a/b/c.git" that yields "c.git", we give "c" for "a/b/c.git".
Likewise "<scheme>://a/b/c/.git" won't yield ".git", we compute
"c").

Having said that, I think guess_target_dir_from_git_url() is clear
enough.

> This would make sense for any operation now or in the future that wants
> to reuse this functionality.

That is mostly for you to decide.   I can help you sanity check the
proposed name(s) with existing callers, but you'd be a better judge
for callers you'll be adding ;-)



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux