Commit df9ea0c9 authored by Frank Terbeck's avatar Frank Terbeck

vcsup: Make stack-auto-push not push a dir that was just popped

parent ce290759
......@@ -239,6 +239,7 @@ function VCSUP_pop() {
function VCSUP_push() {
local maxsize
local -i nodups
[[ "x$VCSUPPUSHGUARD" == 'x-guarded-' ]] && return 0
if (( ${#argv} == 0 )); then
set -- $PWD
fi
......@@ -263,6 +264,7 @@ function VCSUP_push() {
function VCSUP_from_() {
local -i ret
local VCSUPPUSHGUARD='-guarded-'
VCSUP_pop $1
ret=$?
if (( ret == 2 )); then
......@@ -273,6 +275,7 @@ function VCSUP_from_() {
VCSUP_cd "${REPLY}"
ret=$?
fi
unset VCSUPPUSHGUARD
return $ret
}
......
......@@ -151,7 +151,7 @@ tool push
comma ../usb || exit 1
tool push
expect_stack "Many entries on the stack" \
expect_stack "Many entries on the stack #1" \
$base/src/periph/usb \
$base/src/periph/mu \
$base/src/drivers/spi
......@@ -170,6 +170,65 @@ oldpwd=$PWD
comma
expect_stack "Default behaviour does not filter dups" $oldpwd $oldpwd
# "comma +" pops bottom entry from stack:
cd $base
tool clear
comma src/drivers/uart || exit 1
tool push
comma ../spi || exit 1
tool push
comma ../../periph || exit 1
tool push
comma mu || exit 1
tool push
comma ../usb || exit 1
tool push
expect_stack "Many entries on the stack #2" \
$base/src/periph/usb \
$base/src/periph/mu \
$base/src/periph \
$base/src/drivers/spi \
$base/src/drivers/uart
comma +
expect_stack "Many entries on the stack #3" \
$base/src/periph/usb \
$base/src/periph/mu \
$base/src/periph \
$base/src/drivers/spi
expect_pwd "Now in previous bottom entry from stack #1" $base/src/drivers/uart
# The same also works with no tool push calls if stack-auto-push is true
zstyle ':vcsup:*' stack-auto-push true
cd $base
tool clear
comma src/drivers/uart || exit 1
comma ../spi || exit 1
comma ../../periph || exit 1
comma mu || exit 1
comma ../usb || exit 1
expect_stack "Many entries on the stack #4" \
$base/src/periph/usb \
$base/src/periph/mu \
$base/src/periph \
$base/src/drivers/spi \
$base/src/drivers/uart
comma +
expect_stack "Many entries on the stack #5" \
$base/src/periph/usb \
$base/src/periph/mu \
$base/src/periph \
$base/src/drivers/spi
expect_pwd "Now in previous bottom entry from stack #2" $base/src/drivers/uart
zstyle ':vcsup:*' stack-auto-push false
# Teardown
printf '\nRemoving test base directory: %s\n' $base
rm -Rf $base || exit 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment