From: "Joshua T. Corbin" <jcorbin@wunjo.org>
To: git@vger.kernel.org
Subject: [PATCH] git add - recursive directories
Date: Sun, 24 Apr 2005 16:51:23 -0400 [thread overview]
Message-ID: <200504241651.24276.jcorbin@wunjo.org> (raw)
This patch does two things:
1) git add will now by default recursively add any directories given to it.
2) this can be disabled and the old behavior used instead with the new -n
switch.
Signed-off-by: Joshua T. Corbin <jcorbin@wunjo.org>
Index: git
===================================================================
--- 2aaf94eae20acc451553766f3c063bc46cfa75c6/git (mode:100755
sha1:f8f5e0e4e5c50102415cd479619dd7598d3c42e1)
+++ 58dd789846677d8d0848b608e365e9742d2db642/git (mode:100755
sha1:24d8c30383fa11d049aafcd659cefe700afe1cf1)
@@ -25,7 +25,7 @@
Usage: git COMMAND [ARG]...
Available commands:
- add FILE...
+ add [-n] FILE...
addremote RNAME RSYNC_URL
apply < patch on stdin
cancel
Index: gitadd.sh
===================================================================
--- 2aaf94eae20acc451553766f3c063bc46cfa75c6/gitadd.sh (mode:100755
sha1:fa77d96198dd7d5ebf47bdedb296995ab7e77cf3)
+++ 58dd789846677d8d0848b608e365e9742d2db642/gitadd.sh (mode:100755
sha1:f0b030e1b4d770d96dabd5350e25f2e8fad5e59d)
@@ -5,10 +5,31 @@
#
# Takes a list of file names at the command line, and schedules them
# for addition to the GIT repository at the next commit.
+# Optional "-n" parameter specifies that you don't want to add directories
+# recursively.
if [ ! "$1" ]; then
- echo "gitadd.sh: usage: git add FILE..." >&2
+ echo "gitadd.sh: usage: git add [-n] FILE..." >&2
exit 1;
fi
-update-cache --add -- "$@"
+recur=1
+if [ "$1" = "-n" ]; then
+ shift
+ recur=
+fi
+
+if [ $recur ]; then
+ ADDFILE=$(mktemp -t gitadd.XXXXXX)
+ while [ "$1" ]; do
+ if [ -d "$1" ]; then
+ find $1 -type f -and -not -name '.*'
+ else
+ echo "$1"
+ fi
+ shift
+ done > $ADDFILE
+ update-cache --add -- $(cat $ADDFILE)
+else
+ update-cache --add -- "$@"
+fi
reply other threads:[~2005-04-24 20:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200504241651.24276.jcorbin@wunjo.org \
--to=jcorbin@wunjo.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).