git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Luciano Rocha <luciano@eurotux.com>
Cc: git@vger.kernel.org
Subject: Re: backups with git and inotify
Date: Mon, 10 Dec 2007 22:57:46 +0100	[thread overview]
Message-ID: <20071210215746.GA3022@atjola.homenet> (raw)
In-Reply-To: <20071210202911.GA14738@bit.office.eurotux.com>

On 2007.12.10 20:29:11 +0000, Luciano Rocha wrote:
> 
> Hello,
> 
> The following is a work in progress. There are some problems in how I'm
> using git and recording the history:
> 
> 1. I use an opened fd for each monitored directory (and subdirectories),
>    (inotify_add_watch_at would be nice).
>    I fchdir(fd) when a change happens to register and commit it.
> 
> 2. git-rm dir/file also removes <dir> if file was the only entry of
>    <dir>. So, when committing the removal, git complains that it can't
>    find cwd. So I record the parent directory, do the git command, check
>    if getcwd() works, and if not do the commit in the parent directory.
> 
> 3. git-rm (empty) directory fails
> 
> 4. Changes aren't atomic, but I can live with that and I doubt I would
>    be able to make it atomic without implementing a filesystem (FUSE or
>    not).
> 
> I can work around most of the problems, and rewrite to use recorded path
> names instead of directories fd, but before I do that, and while I'm
> at the beginning, I'd like to probe for opinions and suggestions.
> 
> So, please, suggest.

I posted an extremely simple bash script here:
http://lkml.org/lkml/2007/12/7/279

It just employs inotifywait to do all watching and just needs to
translate the events to the different git command. Did just glance over
your code, but it seems to do basically the same thing, just that it's a
lot shorter. The overhead of being a shell script is probably neglible,
as the amount of git calls are likely dominating anyway.

Feel free to ignore my comments on why I think that that is crap anyway
and do whatever you want with the script.

HTH
Björn

  parent reply	other threads:[~2007-12-10 21:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-10 20:29 backups with git and inotify Luciano Rocha
2007-12-10 21:18 ` David Tweed
2007-12-10 21:47   ` Luciano Rocha
2007-12-10 21:57 ` Björn Steinbrink [this message]
2007-12-11 10:25   ` Luciano Rocha
2007-12-11 13:24     ` David Tweed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071210215746.GA3022@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=luciano@eurotux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).