github.com/scorpionis/hub@v2.2.1+incompatible/features/support/fakebin/git (about) 1 #!/bin/bash 2 # A wrapper for system git that prevents commands such as `clone` or `fetch` to be 3 # executed in testing. It logs commands to "~/.history" so afterwards it can be 4 # asserted that they ran. 5 6 command="$1" 7 [ "$command" = "config" ] || echo git "$@" >> "$HOME"/.history 8 9 case "$command" in 10 "clone" | "fetch" | "pull" | "push" ) 11 # don't actually execute these commands 12 exit 13 ;; 14 * ) 15 # note: `submodule add` also initiates a clone, but we work around it 16 if [ "$command $2 $3" = "remote add -f" ]; then 17 subcommand=$2 18 shift 3 19 exec "$HUB_SYSTEM_GIT" $command $subcommand "$@" 20 else 21 exec "$HUB_SYSTEM_GIT" "$@" 22 fi 23 ;; 24 esac