Make autopull.sh more suited for continuous integration.

* autopull.sh: Support option --one-time.
diff --git a/ChangeLog b/ChangeLog
index 6b67b98..e38ad0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2022-07-18  Bruno Haible  <bruno@clisp.org>
 
+	Make autopull.sh more suited for continuous integration.
+	* autopull.sh: Support option --one-time.
+
+2022-07-18  Bruno Haible  <bruno@clisp.org>
+
 	Move gnulib-tool invocation back from autopull.sh to autogen.sh.
 	* autogen.sh: Revert last change. Improve comments.
 	* autopull.sh: Only call 'gitsub.sh pull'.
diff --git a/autopull.sh b/autopull.sh
index 0d08d35..4638d7b 100755
--- a/autopull.sh
+++ b/autopull.sh
@@ -17,8 +17,25 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
-# Usage: ./autopull.sh
+# Usage: ./autopull.sh [--one-time]
+#
+# Options:
+#   --one-time          Optimize, assuming that the current directory will be
+#                       used to build the current version only and will be
+#                       thrown away afterwards.
 
-./gitsub.sh pull || exit 1
+# Parse options.
+
+shallow=
+
+while :; do
+  case "$1" in
+    --one-time) shallow='--depth 1'; shift;;
+    *) break ;;
+  esac
+done
+
+
+./gitsub.sh pull $shallow || exit 1
 
 echo "$0: done.  Now you can run './autogen.sh'."