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

[PATCH] git-cache-meta -- file owner and permissions caching, minimalist approach

From
jidanni@jidanni.org <jidanni@jidanni.org>
Date
Jan 10, 2009, 17:43 UTC
Message-ID
<87eizb12gu.fsf_-_@jidanni.org>
In-Reply-To
<200901082229.46433.bss@iguanasuicide.net>
Signed-off-by: jidanni <jidanni@jidanni.org>
---
 contrib/metadata/git-cache-meta |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
 create mode 100755 contrib/metadata/git-cache-meta
diff --git a/contrib/metadata/git-cache-meta b/contrib/metadata/git-cache-meta
new file mode 100755
index 0000000..5e1b740
--- /dev/null
+++ b/contrib/metadata/git-cache-meta
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+# git-cache-meta -- file owner and permissions caching, minimalist approach
+: ${GIT_CACHE_META_FILE=.git_cache_meta} #simpler not to git-add it
+case $@ in
+    --store|--stdout)
+	case $1 in --store) exec > $GIT_CACHE_META_FILE; esac
+	git ls-files|xargs -I{} find {} \
+	    \( -user ${USER?} -o -printf "chown %u '%p'\n" \) \
+	    \( -group $USER -o -printf "chgrp %g '%p'\n" \) \
+	    \( \( -type l -o -perm 755 -o -perm 644 \) \
+			-o -printf "chmod %#m '%p'\n" \);;#requires GNU Find
+    --apply) sh -e $GIT_CACHE_META_FILE;;
+    *) 1>&2 cat <<EOF; exit 1;;
+Usage: $0 --store|--stdout|--apply #Example:
+# git bundle create mybundle.bdl master; git-cache-meta --store
+# scp mybundle.bdl .git_cache_meta machine2: #then on machine2:
+# git init; git pull mybundle.bdl master; git-cache-meta --apply
+EOF
+esac
-- 
1.6.0.6
Previous: Boyd Stephen Smith Jr.
Message 6 of 6 in “git-cache-meta -- simple file meta data caching and applying”
  1. jidanni@jidanni.orgJan 9, 2009
  2. Jay SoffianJan 9, 2009
  3. Jay SoffianJan 9, 2009
  4. jidanni@jidanni.orgJan 9, 2009
  5. Boyd Stephen Smith Jr.Jan 9, 2009
  6. git-cache-meta -- file owner and permissions caching, minimalist approachjidanni@jidanni.org, Jan 10, 2009

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.