t5540/5541: smart-http does not support "--force-with-lease"
[gitweb.git] / t / lib-t6000.sh
index 102d5678151d5b1fcca731724efb2bd1ad0647d6..4ffd90127edb360142e492f6562c3c15c002d286 100644 (file)
@@ -64,13 +64,30 @@ commit_date () {
        sed -n "s/^committer .*> \([0-9]*\) .*/\1/p"
 }
 
+# Assign the value of fake date to a variable, but
+# allow fairly common "1971-08-16 00:00" to be omittd
+assign_fake_date () {
+       case "$2" in
+       ??:??:??)       eval "$1='1971-08-16 $2'" ;;
+       ??:??)          eval "$1='1971-08-16 00:$2'" ;;
+       ??)             eval "$1='1971-08-16 00:00:$2'" ;;
+       *)              eval "$1='$2'" ;;
+       esac
+}
+
 on_committer_date () {
-       _date=$1
-       shift 1
-       GIT_COMMITTER_DATE="$_date"
+       assign_fake_date GIT_COMMITTER_DATE "$1"
        export GIT_COMMITTER_DATE
+       shift 1
+       "$@"
+}
+
+on_dates () {
+       assign_fake_date GIT_COMMITTER_DATE "$1"
+       assign_fake_date GIT_AUTHOR_DATE "$2"
+       export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
+       shift 2
        "$@"
-       unset GIT_COMMITTER_DATE
 }
 
 # Execute a command and suppress any error output.