git/abspath.c

#include "git-compat-util.h"
#include "abspath.h"
#include "strbuf.h"

/*
 * Do not use this for inspecting *tracked* content.  When path is a
 * symlink to a directory, we do not want to say it is a directory when
 * dealing with tracked content in the working tree.
 */
int is_directory(const char *path)
{}

/* removes the last path component from 'path' except if 'path' is root */
static void strip_last_component(struct strbuf *path)
{}

/* get (and remove) the next component in 'remaining' and place it in 'next' */
static void get_next_component(struct strbuf *next, struct strbuf *remaining)
{}

/* copies root part from remaining to resolved, canonicalizing it on the way */
static void get_root_part(struct strbuf *resolved, struct strbuf *remaining)
{}

/* We allow "recursive" symbolic links. Only within reason, though. */
#ifndef MAXSYMLINKS
#define MAXSYMLINKS
#endif

/*
 * If set, any number of trailing components may be missing; otherwise, only one
 * may be.
 */
#define REALPATH_MANY_MISSING
/* Should we die if there's an error? */
#define REALPATH_DIE_ON_ERROR

static char *strbuf_realpath_1(struct strbuf *resolved, const char *path,
			       int flags)
{}

/*
 * Return the real path (i.e., absolute path, with symlinks resolved
 * and extra slashes removed) equivalent to the specified path.  (If
 * you want an absolute path but don't mind links, use
 * absolute_path().)  Places the resolved realpath in the provided strbuf.
 *
 * The directory part of path (i.e., everything up to the last
 * dir_sep) must denote a valid, existing directory, but the last
 * component need not exist.  If die_on_error is set, then die with an
 * informative error message if there is a problem.  Otherwise, return
 * NULL on errors (without generating any output).
 */
char *strbuf_realpath(struct strbuf *resolved, const char *path,
		      int die_on_error)
{}

/*
 * Just like strbuf_realpath, but allows an arbitrary number of path
 * components to be missing.
 */
char *strbuf_realpath_forgiving(struct strbuf *resolved, const char *path,
				int die_on_error)
{}

char *real_pathdup(const char *path, int die_on_error)
{}

/*
 * Use this to get an absolute path from a relative one. If you want
 * to resolve links, you should use strbuf_realpath.
 */
const char *absolute_path(const char *path)
{}

char *absolute_pathdup(const char *path)
{}

char *prefix_filename(const char *pfx, const char *arg)
{}

char *prefix_filename_except_for_dash(const char *pfx, const char *arg)
{}

void strbuf_add_absolute_path(struct strbuf *sb, const char *path)
{}

void strbuf_add_real_path(struct strbuf *sb, const char *path)
{}