From 921850d05cc450fd2cc8879b8fcd18144c706ee9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 24 Feb 2025 13:48:46 -0400 Subject: [PATCH] support addcomputed --fast This complicates the interface but it's still simpler to understand than the old interface. --- .../compute_special_remote_interface.mdwn | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/design/compute_special_remote_interface.mdwn b/doc/design/compute_special_remote_interface.mdwn index 33c33ad2ad..5c771c17ad 100644 --- a/doc/design/compute_special_remote_interface.mdwn +++ b/doc/design/compute_special_remote_interface.mdwn @@ -14,8 +14,8 @@ a command like one of these: git-annex addcomputed --to=myremote -- compress in out --level=9 git-annex addcomputed --to=myremote -- clip foo 2:01-3:00 combine with bar to baz -Whatever values the user passes to `git-annex addcomputed` are passed on to -the program, followed by any values that the user provided to +Whatever values the user passes to `git-annex addcomputed` are passed to +the program in `ARGV`, followed by any values that the user provided to `git-annex initremote`. To simplify the program's option parsing, any value that the user provides @@ -45,8 +45,15 @@ If an input file is not available, the program's stdin will be closed without a path being written to it. So when reading from stdin fails, the program should exit. -The program computes one or more output files. For each output file that it -will compute, the program should write a line to stdout: +When `git-annex addcomputed --fast` is being used to add a computation +to the git-annex repository without actually performing it, the +response to each "INPUT" will be an empty line rather than the path to +an input file. In that case, the program should proceed with the rest of +its output to stdout (eg "OUTPUT" and "REPRODUCIBLE"), but should not +perform any computation. + +For each output file that it will compute, the program should write a +line to stdout: OUTPUT file.jpeg @@ -93,4 +100,6 @@ An example `git-annex-compute-foo` shell script follows: read input echo "OUTPUT $3" echo REPRODUCIBLE - frobnicate --passes="$ANNEX_COMPUTE_passes" <"$input" >"$3" + if [ -n "$input" ]; then + frobnicate --passes="$ANNEX_COMPUTE_passes" <"$input" >"$3" + fi