Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion git-getpull
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/sh

if [ -z "$(git rev-parse --git-dir 2>/dev/null)" ]; then
if [ -z "$1" ]; then
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-z is a test for strings of length 0, so this check is basically saying, if $1 (the first argument passed to the script) is empty, print usage information. (meaning the user didn’t use the script correctly)

http://tldp.org/LDP/abs/html/comparison-ops.html

echo "Usage: git getpull <SHA>"
exit 1
elif [ -z "$(git rev-parse --git-dir 2>/dev/null)" ]; then
echo "Not in a git directory"
exit 1
else
Expand Down