git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Improve can_hardlink diagnostics, remove suggest_hardlink

From
PRPavel Roskin <proski@gnu.org>
Date
Aug 23, 2005, 16:23 UTC
Message-ID
<1124814238.11038.6.camel@dv>
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
Next: Petr Baudis
Message 1 of 2 in “Improve can_hardlink diagnostics, remove suggest_hardlink”
  1. Improve can_hardlink diagnostics, remove suggest_hardlinkPavel Roskin, Aug 23, 2005
  2. Petr BaudisSep 12, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.