git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-cache-meta -- simple file meta data caching and applying
@ 2009-01-09  0:13 jidanni
  2009-01-09  0:22 ` Jay Soffian
  2009-01-09  4:29 ` Boyd Stephen Smith Jr.
  0 siblings, 2 replies; 6+ messages in thread
From: jidanni @ 2009-01-09  0:13 UTC (permalink / raw)
  To: git

Gentlemen, I have whipped up this:

#!/bin/sh -e
#git-cache-meta -- simple file meta data caching and applying.
#Simpler than etckeeper, metastore, setgitperms, etc.
: ${GIT_CACHE_META_FILE=.git_cache_meta}
case $@ in
    --store|--stdout)
	case $1 in --store) exec > $GIT_CACHE_META_FILE; esac
	find $(git ls-files) \
	    \( -user ${USER?} -o -printf 'chowm %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' \);;
    --apply) sh -e $GIT_CACHE_META_FILE;;
    *) 1>&2 echo "Usage: $0 --store|--stdout|--apply"; exit 1;;
esac

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

* Re: git-cache-meta -- simple file meta data caching and applying
  2009-01-09  0:13 git-cache-meta -- simple file meta data caching and applying jidanni
@ 2009-01-09  0:22 ` Jay Soffian
  2009-01-09  0:28   ` Jay Soffian
  2009-01-09  4:29 ` Boyd Stephen Smith Jr.
  1 sibling, 1 reply; 6+ messages in thread
From: Jay Soffian @ 2009-01-09  0:22 UTC (permalink / raw)
  To: jidanni; +Cc: git

On Thu, Jan 8, 2009 at 7:13 PM,  <jidanni@jidanni.org> wrote:
> Gentlemen, I have whipped up this:
>
> #!/bin/sh -e
> #git-cache-meta -- simple file meta data caching and applying.
> #Simpler than etckeeper, metastore, setgitperms, etc.
> : ${GIT_CACHE_META_FILE=.git_cache_meta}
> case $@ in
>    --store|--stdout)
>        case $1 in --store) exec > $GIT_CACHE_META_FILE; esac
>        find $(git ls-files) \
>            \( -user ${USER?} -o -printf 'chowm %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' \);;
>    --apply) sh -e $GIT_CACHE_META_FILE;;
>    *) 1>&2 echo "Usage: $0 --store|--stdout|--apply"; exit 1;;
> esac

It doesn't handle paths which contain white-space. "chown" is typo'd
as "chowm". To be useful, the contribution might also include
instructions on how it should be used with git, and perhaps also
reasoning for why someone would want to use it in place of etckeeper,
metastore, setgitperms, etc.

j.

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

* Re: git-cache-meta -- simple file meta data caching and applying
  2009-01-09  0:22 ` Jay Soffian
@ 2009-01-09  0:28   ` Jay Soffian
  2009-01-09  2:50     ` jidanni
  0 siblings, 1 reply; 6+ messages in thread
From: Jay Soffian @ 2009-01-09  0:28 UTC (permalink / raw)
  To: jidanni; +Cc: git

On Thu, Jan 8, 2009 at 7:22 PM, Jay Soffian <jaysoffian@gmail.com> wrote:
> It doesn't handle paths which contain white-space. "chown" is typo'd
> as "chowm". To be useful, the contribution might also include
> instructions on how it should be used with git, and perhaps also
> reasoning for why someone would want to use it in place of etckeeper,
> metastore, setgitperms, etc.

It will also blow-up if the output of "git ls-files" exceeds
limitations on number of arguments. Also, might be worth mentioning it
requires GNU find.

j.

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

* Re: git-cache-meta -- simple file meta data caching and applying
  2009-01-09  0:28   ` Jay Soffian
@ 2009-01-09  2:50     ` jidanni
  0 siblings, 0 replies; 6+ messages in thread
From: jidanni @ 2009-01-09  2:50 UTC (permalink / raw)
  To: jaysoffian; +Cc: git

Fixed. Manly the program aims to be tiny. Perhaps I should include a
full example of using it with git-bundle.

#!/bin/sh -e
#git-cache-meta -- file meta data caching for possible use with
#git-bundle, git-fast-export, git-archive, hooks, as a simple
#alternative to etckeeper, metastore, setgitperms. Requires GNU Find.
: ${GIT_CACHE_META_FILE=.git_cache_meta}
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' \);;
    --apply) sh -e $GIT_CACHE_META_FILE;;
    *) 1>&2 echo "Usage: $0 --store|--stdout|--apply"; exit 1;;
esac

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

* Re: git-cache-meta -- simple file meta data caching and applying
  2009-01-09  0:13 git-cache-meta -- simple file meta data caching and applying jidanni
  2009-01-09  0:22 ` Jay Soffian
@ 2009-01-09  4:29 ` Boyd Stephen Smith Jr.
  2009-01-10 17:43   ` [PATCH] git-cache-meta -- file owner and permissions caching, minimalist approach jidanni
  1 sibling, 1 reply; 6+ messages in thread
From: Boyd Stephen Smith Jr. @ 2009-01-09  4:29 UTC (permalink / raw)
  To: jidanni; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 865 bytes --]

On Thursday 08 January 2009, jidanni@jidanni.org wrote 
about 'git-cache-meta -- simple file meta data caching and applying':
>Gentlemen, I have whipped up this:
>
>#!/bin/sh -e
>#git-cache-meta -- simple file meta data caching and applying.
>#Simpler than etckeeper, metastore, setgitperms, etc.

You *might* look at pristine-tar from Debian.  It's specifically designed 
to be able to generate the .orig.tar.gz that Debian packages are based on 
from a VCS checkout, but it's code might be useful.

I do like your script though.  It's simple and the output is plain text so 
it is easy to have your VCS maintain it.
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss@iguanasuicide.net                     ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.net/                      \_/     

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* [PATCH] git-cache-meta -- file owner and permissions caching, minimalist approach
  2009-01-09  4:29 ` Boyd Stephen Smith Jr.
@ 2009-01-10 17:43   ` jidanni
  0 siblings, 0 replies; 6+ messages in thread
From: jidanni @ 2009-01-10 17:43 UTC (permalink / raw)
  To: gitster; +Cc: git

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

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

end of thread, other threads:[~2009-01-10 17:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-09  0:13 git-cache-meta -- simple file meta data caching and applying jidanni
2009-01-09  0:22 ` Jay Soffian
2009-01-09  0:28   ` Jay Soffian
2009-01-09  2:50     ` jidanni
2009-01-09  4:29 ` Boyd Stephen Smith Jr.
2009-01-10 17:43   ` [PATCH] git-cache-meta -- file owner and permissions caching, minimalist approach jidanni

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 NNTP newsgroup(s).