threads / patch / 9375

patchgit-clone: use cpio's --quiet flag

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

## tl;dr

9 messages between Aug 4, 2007 and Aug 5, 2007. Diffs are folded; open one to read it.

replies: 8people: 3as markdown or json

Jeff King· Aug 4, 2007, 07:03 UTC · lore

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(-)
Show changes to git-clone.sh +2 −1
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· Aug 4, 2007, 15:36 UTC · re: Jeff King · lore

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

Hi,
On Sat, 4 Aug 2007, Jeff King wrote:
Show 6 quoted lines
> 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· Aug 4, 2007, 16:04 UTC · re: Johannes Schindelin · lore

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

On Sat, Aug 04, 2007 at 04:36:59PM +0100, Johannes Schindelin wrote:
Show 6 quoted lines
> > $ 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· Aug 4, 2007, 17:48 UTC · re: Jeff King · lore

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

Jeff King <peff@peff.net> writes:
Show 15 quoted lines
> 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· Aug 4, 2007, 17:52 UTC · re: Junio C Hamano · lore

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

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· Aug 4, 2007, 18:27 UTC · re: Jeff King · lore

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

Jeff King <peff@peff.net> writes:
Show 7 quoted lines
> 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· Aug 5, 2007, 08:06 UTC · re: Junio C Hamano · lore

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

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· Aug 5, 2007, 08:36 UTC · re: Jeff King · lore

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

Jeff King <peff@peff.net> writes:
Show 11 quoted lines
> 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· Aug 5, 2007, 09:36 UTC · re: Junio C Hamano · lore

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

On Sun, Aug 05, 2007 at 01:36:29AM -0700, Junio C Hamano wrote:
Show 9 quoted lines
> > 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

← back to recent threads