git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Improve can_hardlink diagnostics, remove suggest_hardlink
@ 2005-08-23 16:23 Pavel Roskin
  2005-09-12  0:14 ` Petr Baudis
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Roskin @ 2005-08-23 16:23 UTC (permalink / raw
  To: Petr Baudis, git

Hello!

suggest_hardlink is write-only in cg-pull - remove it.  can_hardlink
should not be shown to the user as is (it's either "l" or empty) - we
should output something meaningful instead.

Signed-off-by: Pavel Roskin <proski@gnu.org>

diff --git a/cg-pull b/cg-pull
--- a/cg-pull
+++ b/cg-pull
@@ -207,7 +207,6 @@ fetch_local()
 	cp_flags_l="-vdpR"
 	if [ "$1" = "-u" ]; then
 		cp_flags_l="$cp_flags_l -fu$can_hardlink"
-		suggest_hardlink=
 		shift
 	fi
 
@@ -293,12 +292,16 @@ else
 	symlinked=
 	is_same_repo "$_git_objects" "$uri/objects" && symlinked=1
 
-	# See if we can hardlink and drop "l" if not.
+	# See if we can hardlink and add "-l" to cp flags.
 	can_hardlink=
 	sample_file=$(find $uri -type f -print | head -n 1)
 	rm -f $_git/.,,lntest
-	ln "$sample_file" "$_git/.,,lntest" 2>/dev/null && can_hardlink=l
-	echo $can_hardlink
+	if cp -fl "$sample_file" "$_git/.,,lntest" 2>/dev/null; then
+		can_hardlink=l
+		echo "Using hard links"
+	else
+		echo "Hard links don't work - using copy"
+	fi
 	rm -f $_git/.,,lntest
 fi
 


-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Improve can_hardlink diagnostics, remove suggest_hardlink
  2005-08-23 16:23 [PATCH] Improve can_hardlink diagnostics, remove suggest_hardlink Pavel Roskin
@ 2005-09-12  0:14 ` Petr Baudis
  0 siblings, 0 replies; 2+ messages in thread
From: Petr Baudis @ 2005-09-12  0:14 UTC (permalink / raw
  To: Pavel Roskin; +Cc: git

Dear diary, on Tue, Aug 23, 2005 at 06:23:58PM CEST, I got a letter
where Pavel Roskin <proski@gnu.org> told me that...
> Hello!

Hello,

> suggest_hardlink is write-only in cg-pull - remove it.  can_hardlink
> should not be shown to the user as is (it's either "l" or empty) - we
> should output something meaningful instead.

actually, the infamous "l" output was just a leftover debugging print I
forgot to remove. ;-) Well, I guess it doesn't hurt if the user is
notified whether hardlinking is done or not.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
If you want the holes in your knowledge showing up try teaching
someone.  -- Alan Cox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-09-12  0:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-23 16:23 [PATCH] Improve can_hardlink diagnostics, remove suggest_hardlink Pavel Roskin
2005-09-12  0:14 ` Petr Baudis

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).