enter_repo: do not modify input
entr_repo(..., 0) currently modifies the input to strip away trailing slashes. This means that we some times need to copy the input to keep the original. Change it to unconditionally copy it into the used_path buffer so we can safely use the input without having to copy it. Also store a working copy in validated_path up-front before we start resolving anything. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Phil Hord <hordp@cisco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
703f05ad58
commit
1c64b48e67
2
cache.h
2
cache.h
@ -734,7 +734,7 @@ int safe_create_leading_directories(char *path);
|
||||
int safe_create_leading_directories_const(const char *path);
|
||||
int mkdir_in_gitdir(const char *path);
|
||||
extern char *expand_user_path(const char *path);
|
||||
char *enter_repo(char *path, int strict);
|
||||
const char *enter_repo(const char *path, int strict);
|
||||
static inline int is_absolute_path(const char *path)
|
||||
{
|
||||
return is_dir_sep(path[0]) || has_dos_drive_prefix(path);
|
||||
|
Reference in New Issue
Block a user