Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit 63274d11 authored by gsell's avatar gsell
Browse files

Merge branch '140-std-split_fname-remove-leading-slash' into 'master'

Resolve "std:split_fname(): remove leading slash"

Closes #140

See merge request !110
parents f75f00db 6d53069b
No related branches found
No related tags found
1 merge request!110Resolve "std:split_fname(): remove leading slash"
......@@ -133,16 +133,29 @@ std::replace_path () {
}
#
# split file name
# split an absolute path
#
std::split_fname() {
local -r savedIFS="${IFS}"
# Args:
# $1 upvar
# $2 absolute path
# $3 opt upvar: number of components
#
std::split_abspath() {
local parts="$1"
local -r path="$2"
if [[ "${path:0:1}" == '/' ]]; then
local -r std__split_path_tmp="${path:1}"
else
std::die 255 "Oops: Internal error in '${FUNCNAME[0]}' called by '${FUNCNAME[1]}' }"
fi
IFS='/'
local std__split_fname_result__=( $(echo "${@: -1}") )
IFS=${savedIFS}
eval $1=\(\"\${std__split_fname_result__[@]}\"\)
local std__split_path_result=( ${std__split_path_tmp} )
unset IFS
std::upvar ${parts} "${std__split_path_result[@]}"
if (( $# >= 3 )); then
eval $2=${#std__split_fname_result__[@]}
# return number of parts
std::upvar "$3" ${#std__split_path_result[@]}
fi
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment