diff options
author | Alexander Potashev <aspotashev@gmail.com> | 2009-01-10 15:07:50 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-01-11 13:21:57 -0800 |
commit | 8ca12c0d62c0be4a4987c4a936467ea2a92e915a (patch) | |
tree | 42b4cafd04bbbdfa90a38b6a49396cd3b06a97db /remote.c | |
parent | c123b7c5fb596d93cd015645212c379fc3c381d5 (diff) | |
download | git-8ca12c0d62c0be4a4987c4a936467ea2a92e915a.tar.gz git-8ca12c0d62c0be4a4987c4a936467ea2a92e915a.tar.xz |
add is_dot_or_dotdot inline function
A new inline function is_dot_or_dotdot is used to check if the
directory name is either "." or "..". It returns a non-zero value if
the given string is "." or "..". It's applicable to a lot of Git
source code.
Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r-- | remote.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -4,6 +4,7 @@ #include "commit.h" #include "diff.h" #include "revision.h" +#include "dir.h" static struct refspec s_tag_refspec = { 0, @@ -634,10 +635,7 @@ static struct refspec *parse_push_refspec(int nr_refspec, const char **refspec) static int valid_remote_nick(const char *name) { - if (!name[0] || /* not empty */ - (name[0] == '.' && /* not "." */ - (!name[1] || /* not ".." */ - (name[1] == '.' && !name[2])))) + if (!name[0] || is_dot_or_dotdot(name)) return 0; return !strchr(name, '/'); /* no slash */ } |