From bd7c84d0a4cc1709b1f9682284cdc0ee966a75b6 Mon Sep 17 00:00:00 2001 From: "https://www.google.com/accounts/o8/id?id=AItOawlOWqoYhI23FAYG8M4R3-wb1AvhtXMhKfs" Date: Fri, 20 Feb 2015 14:43:42 +0000 Subject: --- doc/todo/Adding_support_for_.hgignore.mdwn | 91 ++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/doc/todo/Adding_support_for_.hgignore.mdwn b/doc/todo/Adding_support_for_.hgignore.mdwn index 7d31a47..054bb8d 100644 --- a/doc/todo/Adding_support_for_.hgignore.mdwn +++ b/doc/todo/Adding_support_for_.hgignore.mdwn @@ -71,6 +71,97 @@ Since some distros are already considered please integrate the Gentoo package ma +# There is something missing if only recording uid/gid/mode for tracked files... +All dirnames of every file must also get the right permissions. + +I only did the hg source part. Using bash arrays could be better, I tried to stay sh compatible. This is a quick hack, not completely tested... + +[[!format bash """ +# diff -uNr /root/src/etckeeper/pre-commit.d/30store-metadata /etc/etckeeper/pre-commit.d/30store-metadata +--- /root/src/etckeeper/pre-commit.d/30store-metadata 2015-02-20 15:36:24.912374338 +0100 ++++ /etc/etckeeper/pre-commit.d/30store-metadata 2015-02-20 15:34:10.770378997 +0100 +@@ -44,6 +44,21 @@ + sed -e "s/'/'\"'\"'/g" -e "s/^/'/" -e "s/$/'/" + } + ++getdirname() { ++ # Permissions of all parent dirnames must also be recorded ++ local p ++ # Print the file itself ++ printf '%s' "$p" ++ p=${1%/*} ++ # Print the files dirnames ++ while [[ $p = */* ]]; do ++ printf ' %s' "$p" ++ p=${p%/*} ++ done ++ # Print the parent dirname ++ printf ' %s' "$p" ++} ++ + generate_metadata() { + # This function generates the script commands to fix any file + # ownerships that aren't owner=root, group=root, as well as to +@@ -57,9 +72,17 @@ + # but we want find to ignore the VCS files themselves. + # + # (Note that when using this, the find expression must end with +- # -print or -exec, else the excluded directories will actually be +- # printed!) +- NOVCS='. -path ./.git -prune -o -path ./.bzr -prune -o -path ./.hg -prune -o -path ./_darcs -prune -o' ++ # -print or -exec, else the excluded directories will actually be ++ # printed!) ++ if [ "$VCS" = hg ]; then ++ HG_FILES="$(hg status -nacu)" ++ HG_FILES_DIRS="" ++ for file in $HG_FILES; do ++ HG_FILES_DIRS+=" $(getdirname $file)" ++ done ++ ++ fi ++ NOVCS="${ALL_FILES:-.} -path ./.git -prune -o -path ./.bzr -prune -o -path ./.hg -prune -o -path ./_darcs -prune -o" + + # Keep the sort order the same at all times. + LC_COLLATE=C +@@ -68,8 +91,9 @@ + if [ "$VCS" = git ] || [ "$VCS" = hg ]; then + # These version control systems do not track directories, + # so empty directories must be stored specially. +- find $NOVCS -type d -empty -print | +- sort | shellquote | sed -e "s/^/mkdir -p /" ++# find ${ALL_FILES:- } $NOVCS -type d -empty -print | ++# sort | shellquote | sed -e "s/^/mkdir -p /" ++ true + fi + + if [ "$VCS" = darcs ]; then +@@ -83,7 +107,8 @@ + + # Store things that don't have the default user or group. + # Store all file modes, in case the user has an unusual umask. +- find $NOVCS \( -type f -or -type d \) -print | filter_ignore | sort | perl -ne ' ++ #find $NOVCS \( -type f -or -type d \) -print | filter_ignore | sort | perl -ne ' ++ echo $HG_FILES_DIRS | tr " " "\n" | sort -u | perl -ne ' + BEGIN { $q=chr(39) } + sub uidname { + my $want=shift; +@@ -110,12 +135,12 @@ + s/^/$q/; + s/$/$q/; + if ($uid != $>) { +- printf "maybe chown $q%s$q %s\n", uidname($uid), $_; ++ printf "maybe chown -c $q%s$q %s\n", uidname($uid), $_; + } + if ($gid != $)) { +- printf "maybe chgrp $q%s$q %s\n", gidname($gid), $_; ++ printf "maybe chgrp -c $q%s$q %s\n", gidname($gid), $_; + } +- printf "maybe chmod %04o %s\n", $mode & 07777, $_; ++ printf "maybe chmod -c %04o %s\n", $mode & 07777, $_; + ' + + # We don't handle xattrs. +"""]] Best regards, Massimo -- cgit v1.2.3 From dde9d3cacc784c7114ba6eb1fba97a0e93b11566 Mon Sep 17 00:00:00 2001 From: "https://www.google.com/accounts/o8/id?id=AItOawlOWqoYhI23FAYG8M4R3-wb1AvhtXMhKfs" Date: Wed, 25 Feb 2015 13:12:11 +0000 Subject: --- doc/todo/Adding_support_for_.hgignore.mdwn | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/todo/Adding_support_for_.hgignore.mdwn b/doc/todo/Adding_support_for_.hgignore.mdwn index 054bb8d..cb694c7 100644 --- a/doc/todo/Adding_support_for_.hgignore.mdwn +++ b/doc/todo/Adding_support_for_.hgignore.mdwn @@ -163,5 +163,14 @@ I only did the hg source part. Using bash arrays could be better, I tried to sta # We don't handle xattrs. """]] +I added an init hook for any update, so after cloning to a new location and updating, all permissions are going to be fixed: +[hooks] + +[[!format python """ +# pre-commit hook for etckeeper, to store metadata and do sanity checks +pre-commit = etckeeper pre-commit -d "$(hg root)" +post-update = etckeeper init "$(hg root)" +"""]] + Best regards, Massimo -- cgit v1.2.3 From ef77a7e9848fdc9e4b7682558684db21e3aea2b1 Mon Sep 17 00:00:00 2001 From: Apaz Date: Wed, 25 Feb 2015 15:53:40 +0000 Subject: --- doc/todo/automatic_git_gc.mdwn | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 doc/todo/automatic_git_gc.mdwn diff --git a/doc/todo/automatic_git_gc.mdwn b/doc/todo/automatic_git_gc.mdwn new file mode 100644 index 0000000..1359661 --- /dev/null +++ b/doc/todo/automatic_git_gc.mdwn @@ -0,0 +1,4 @@ +Hi + +You should add so it runs "git gc" automatic. +I know I can add it manually but better if its included -- cgit v1.2.3