# [PATCH] git-clone: use cpio's --quiet flag

9 messages from 2007-08-04 to 2007-08-05. Participants: Jeff King, Johannes Schindelin, Junio C Hamano.
Thread: https://gitlist.dev/t/9375

## Jeff King, 2007-08-04 07:03

Subject: [PATCH] git-clone: use cpio's --quiet flag
Message-ID: <20070804070308.GA6493@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20070804070308.GA6493%40coredump.intra.peff.net

```
Without this flag, cpio prints the number of blocks copied,
leading to the somewhat confusing git-clone output:

$ git-clone foo bar
Initialized empty Git repository in ...
0 blocks

Signed-off-by: Jeff King <peff@peff.net>
---
This is obviously on top of the jc/clone topic in next.

 git-clone.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-clone.sh b/git-clone.sh
index 4c9b1c9..ccfc316 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -281,7 +281,8 @@ yes)
 			fi
 		fi &&
 		cd "$repo" &&
-		find objects -depth -print | cpio -pumd$l "$GIT_DIR/" || exit 1
+		find objects -depth -print | cpio --quiet -pumd$l "$GIT_DIR/" \
+			|| exit 1
 	fi
 	git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" || exit 1
 	;;
-- 
1.5.3.rc3.942.g536b2

```

## Johannes Schindelin, 2007-08-04 15:36

Subject: Re: [PATCH] git-clone: use cpio's --quiet flag
Message-ID: <Pine.LNX.4.64.0708041636290.14781@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0708041636290.14781%40racer.site
In-Reply-To: <20070804070308.GA6493@coredump.intra.peff.net>

```
Hi,

On Sat, 4 Aug 2007, Jeff King wrote:

> Without this flag, cpio prints the number of blocks copied,
> leading to the somewhat confusing git-clone output:
> 
> $ git-clone foo bar
> Initialized empty Git repository in ...
> 0 blocks

According to http://www.opengroup.org/onlinepubs/7990989775/xcu/cpio.html, 
cpio does not know about --quiet.  I think this is another GNUism...

Ciao,
Dscho

```

## Jeff King, 2007-08-04 16:04

Subject: Re: [PATCH] git-clone: use cpio's --quiet flag
Message-ID: <20070804160409.GA16326@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20070804160409.GA16326%40sigill.intra.peff.net
In-Reply-To: <Pine.LNX.4.64.0708041636290.14781@racer.site>

```
On Sat, Aug 04, 2007 at 04:36:59PM +0100, Johannes Schindelin wrote:

> > $ git-clone foo bar
> > Initialized empty Git repository in ...
> > 0 blocks
> 
> According to http://www.opengroup.org/onlinepubs/7990989775/xcu/cpio.html, 
> cpio does not know about --quiet.  I think this is another GNUism...

Ugh, I didn't even think to check the spec, thanks for looking (I should
have been tipped off by the presence only of a long option).

I'm not sure what the best solution is...adding --quiet makes it totally
unportable, but that message almost looks like an error. We can redirect
stderr, but then we potentially miss real errors. I guess we could grep
it out.

-Peff

```

## Junio C Hamano, 2007-08-04 17:48

Subject: Re: [PATCH] git-clone: use cpio's --quiet flag
Message-ID: <7vwswbgphu.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vwswbgphu.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20070804160409.GA16326@sigill.intra.peff.net>

```
Jeff King <peff@peff.net> writes:

> On Sat, Aug 04, 2007 at 04:36:59PM +0100, Johannes Schindelin wrote:
>
>> > $ git-clone foo bar
>> > Initialized empty Git repository in ...
>> > 0 blocks
>> 
>> According to http://www.opengroup.org/onlinepubs/7990989775/xcu/cpio.html, 
>> cpio does not know about --quiet.  I think this is another GNUism...
>
> Ugh, I didn't even think to check the spec, thanks for looking (I should
> have been tipped off by the presence only of a long option).
>
> I'm not sure what the best solution is...adding --quiet makes it totally
> unportable, but that message almost looks like an error. We can redirect
> stderr, but then we potentially miss real errors.

I was hoping that we can say that the output is analogous to the
native transport reporting "Conting objects: XXXX" and stuff...

```

## Jeff King, 2007-08-04 17:52

Subject: Re: [PATCH] git-clone: use cpio's --quiet flag
Message-ID: <20070804175240.GB17113@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20070804175240.GB17113%40sigill.intra.peff.net
In-Reply-To: <7vwswbgphu.fsf@assigned-by-dhcp.cox.net>

```
On Sat, Aug 04, 2007 at 10:48:29AM -0700, Junio C Hamano wrote:

> I was hoping that we can say that the output is analogous to the
> native transport reporting "Conting objects: XXXX" and stuff...

It always says "0 blocks" for me, which looks a bit like an error (but
the clone seems to work fine).

-Peff

```

## Junio C Hamano, 2007-08-04 18:27

Subject: Re: [PATCH] git-clone: use cpio's --quiet flag
Message-ID: <7vps23gnpj.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vps23gnpj.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20070804175240.GB17113@sigill.intra.peff.net>

```
Jeff King <peff@peff.net> writes:

> On Sat, Aug 04, 2007 at 10:48:29AM -0700, Junio C Hamano wrote:
>
>> I was hoping that we can say that the output is analogous to the
>> native transport reporting "Conting objects: XXXX" and stuff...
>
> It always says "0 blocks" for me, which looks a bit like an error (but
> the clone seems to work fine).

Try cloning across filesystem boundaries so that you do not get
a hardlink -- you will get block count of the copy ;-)

```

## Jeff King, 2007-08-05 08:06

Subject: Re: [PATCH] git-clone: use cpio's --quiet flag
Message-ID: <20070805080651.GB10863@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20070805080651.GB10863%40coredump.intra.peff.net
In-Reply-To: <7vps23gnpj.fsf@assigned-by-dhcp.cox.net>

```
On Sat, Aug 04, 2007 at 11:27:04AM -0700, Junio C Hamano wrote:

> Try cloning across filesystem boundaries so that you do not get
> a hardlink -- you will get block count of the copy ;-)

I see, though the hardlink warning is a bit much.

$ git-clone /path/on/fs/one /path/on/fs/two
Initialized empty Git repository in /path/on/fs/two/.git/
Warning: -l asked but cannot hardlink to /path/on/fs/one/.git
36634 blocks

-Peff

```

## Junio C Hamano, 2007-08-05 08:36

Subject: Re: [PATCH] git-clone: use cpio's --quiet flag
Message-ID: <7v4pjefkdu.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v4pjefkdu.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20070805080651.GB10863@coredump.intra.peff.net>

```
Jeff King <peff@peff.net> writes:

> On Sat, Aug 04, 2007 at 11:27:04AM -0700, Junio C Hamano wrote:
>
>> Try cloning across filesystem boundaries so that you do not get
>> a hardlink -- you will get block count of the copy ;-)
>
> I see, though the hardlink warning is a bit much.
>
> $ git-clone /path/on/fs/one /path/on/fs/two
> Initialized empty Git repository in /path/on/fs/two/.git/
> Warning: -l asked but cannot hardlink to /path/on/fs/one/.git
> 36634 blocks

True; -l is not given explicitly in your example.  Should be
trivial to fix.

```

## Jeff King, 2007-08-05 09:36

Subject: Re: [PATCH] git-clone: use cpio's --quiet flag
Message-ID: <20070805093645.GD12507@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20070805093645.GD12507%40coredump.intra.peff.net
In-Reply-To: <7v4pjefkdu.fsf@assigned-by-dhcp.cox.net>

```
On Sun, Aug 05, 2007 at 01:36:29AM -0700, Junio C Hamano wrote:

> > I see, though the hardlink warning is a bit much.
> >
> > $ git-clone /path/on/fs/one /path/on/fs/two
> > Initialized empty Git repository in /path/on/fs/two/.git/
> > Warning: -l asked but cannot hardlink to /path/on/fs/one/.git
> > 36634 blocks
> 
> True; -l is not given explicitly in your example.  Should be
> trivial to fix.

Ah, indeed, I had assumed that it came from cpio (which also uses the -l
flag!), but reading the code, it's us. Given that "-l" is now the
default, and we silently downgrade to copying anyway, I don't see the
point of having any warning at all. Unless, I guess, for those people
who are still using "-l" even though it's a noop.

-Peff

```
