* [PATCH] git add - recursive directories
@ 2005-04-24 20:51 Joshua T. Corbin
0 siblings, 0 replies; only message in thread
From: Joshua T. Corbin @ 2005-04-24 20:51 UTC (permalink / raw)
To: git
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-04-24 20:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-24 20:51 [PATCH] git add - recursive directories Joshua T. Corbin
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).