* [COGITO PATCH] Allow file list for cg-add through stdin
@ 2005-05-29 17:40 Jochen Roemling
2005-05-29 18:04 ` Petr Baudis
0 siblings, 1 reply; 4+ messages in thread
From: Jochen Roemling @ 2005-05-29 17:40 UTC (permalink / raw)
To: Git Mailing List
|Hello,
how is the preferred way to add a whole new directory to a
git-repository using cogito?
Currently cg-add expects all new files on the command line.
The following patch allows to feed files through stdin, which allows to do
find mynewdir -type f | cg-add -
What about a functionality to specify a directory on the command line
and all files are
recursively added?
Signed-off-by: Jochen Roemling <jochen@roemling.net>
--- a/cg-add 2005-05-29 19:27:17.000000000 +0200
+++ b/cg-add 2005-05-29 19:32:42.000000000 +0200
@@ -10,12 +10,24 @@
[ "$1" ] || die "usage: cg-add FILE..."
-for file in "$@"; do
- if [ -f "$file" ] || [ -h "$file" ]; then
- echo "Adding file $file"
- else
- die "$file does not exist"
- fi
-done
+if [ "$1" == '-' ]; then
+ set $@ ""
+ while read file; do
+ if [ -f "$file" ] || [ -h "$file" ]; then
+ echo "Adding file $file"
+ set $@ "$file"
+ else
+ die "$file does not exist"
+ fi
+ done
+else
+ for file in "$@"; do
+ if [ -f "$file" ] || [ -h "$file" ]; then
+ echo "Adding file $file"
+ else
+ die "$file does not exist"
+ fi
+ done
+fi
git-update-cache --add -- "$@"
|
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [COGITO PATCH] Allow file list for cg-add through stdin
2005-05-29 17:40 [COGITO PATCH] Allow file list for cg-add through stdin Jochen Roemling
@ 2005-05-29 18:04 ` Petr Baudis
[not found] ` <429A0818.6080807@roemling.net>
0 siblings, 1 reply; 4+ messages in thread
From: Petr Baudis @ 2005-05-29 18:04 UTC (permalink / raw)
To: Jochen Roemling; +Cc: Git Mailing List
Dear diary, on Sun, May 29, 2005 at 07:40:26PM CEST, I got a letter
where Jochen Roemling <jochen@roemling.net> told me that...
> |Hello,
Hello,
> how is the preferred way to add a whole new directory to a
> git-repository using cogito?
> Currently cg-add expects all new files on the command line.
> The following patch allows to feed files through stdin, which allows to do
>
> find mynewdir -type f | cg-add -
if you really want to do that, pass it through xargs...
> What about a functionality to specify a directory on the command line
> and all files are
> recursively added?
...but I think this is definitively the right way to go.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-05-29 20:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-29 17:40 [COGITO PATCH] Allow file list for cg-add through stdin Jochen Roemling
2005-05-29 18:04 ` Petr Baudis
[not found] ` <429A0818.6080807@roemling.net>
2005-05-29 18:46 ` Petr Baudis
2005-05-29 20:22 ` Jochen Roemling
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).