From 3c874ce9f4694674e1f476b6ee4a116dd16a7178 Mon Sep 17 00:00:00 2001 From: David Rogers Date: Fri, 30 Oct 2015 22:12:16 -0400 Subject: [PATCH 1/3] Use `$@` instead of `$*` re #467 Blind first pass so that I have a PR to remind me... --- bin/git-touch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/git-touch b/bin/git-touch index 25627f7..0cccada 100755 --- a/bin/git-touch +++ b/bin/git-touch @@ -1,8 +1,8 @@ #!/usr/bin/env bash -filename="$*" +test $# -lt 1 && echo "filename required" 1>&2 && exit 1 -test -z "$filename" && echo "filename required" 1>&2 && exit 1 +filenames="$@" -touch "$filename" \ - && git add "$filename" +touch "$filenames" \ + && git add "$filenames" From 64639e1437ab9d1b9b43dc698190f2f65b3c6564 Mon Sep 17 00:00:00 2001 From: David Rogers Date: Mon, 28 Dec 2015 14:06:30 -0500 Subject: [PATCH 2/3] Touch multiple files supplied --- bin/git-touch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/git-touch b/bin/git-touch index 0cccada..101eaf3 100755 --- a/bin/git-touch +++ b/bin/git-touch @@ -4,5 +4,7 @@ test $# -lt 1 && echo "filename required" 1>&2 && exit 1 filenames="$@" -touch "$filenames" \ - && git add "$filenames" +for filename in $@; do + touch "$filename" \ + && git add "$filename" +done From 2b042bdd594def51a97d96aa7919307853ab2c06 Mon Sep 17 00:00:00 2001 From: David Rogers Date: Mon, 28 Dec 2015 14:07:09 -0500 Subject: [PATCH 3/3] Better USAGE message --- bin/git-touch | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/git-touch b/bin/git-touch index 101eaf3..05b7158 100755 --- a/bin/git-touch +++ b/bin/git-touch @@ -1,8 +1,11 @@ #!/usr/bin/env bash -test $# -lt 1 && echo "filename required" 1>&2 && exit 1 +USAGE(){ + echo "git touch [ . . .]" 1>&2 + exit 1 +} -filenames="$@" +test $# -lt 1 && USAGE for filename in $@; do touch "$filename" \