All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: "Björn Steinbrink" <B.Steinbrink@gmx.de>
Cc: git@vger.kernel.org
Subject: inotify-commit, was Re: git guidance
Date: Fri, 28 Aug 2009 14:30:46 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.1.00.0908281424100.7434@intel-tinevez-2-302> (raw)
In-Reply-To: <20071207220025.GD2001@atjola.homenet>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2440 bytes --]

Hi,

[long Cc: list culled, as they probably forgot about this thread]

On Fri, 7 Dec 2007, Björn Steinbrink wrote:

> That said, out of pure curiousness I came up with the attached script 
> which just uses inotifywait to watch a directory and issue git commands 
> on certain events. It is extremely stupid, but seems to work. And at 
> least it hasn't got the drawbacks of a real gitfs regarding the need to 
> have a "separate" non-versioned storage area for the working directory, 
> because it simply uses the existing working directory wherever that 
> might be stored. It doesn't use GIT_DIR/WORK_DIR yet, but hey, should be 
> easy to add...
> 
> Feel free to mess with that thing, hey, maybe you even like it and
> extend it to match your proposed workflow even more. I for sure won't
> use or even extend it, so you're likely on your own there.
> 
> Side-note: Writing that script probably took less time than writing this
> email and probably less time than was wasted on this topic. Makes me
> want to use today's preferred "Code talks, b...s... walks" statement,
> but I'll refrain from that... Just because I lack the credibility to say
> that, and the script attached is quite crappy ;-)

I could not agree more with the statement.

As it happens, I have a very delicate setup that we tested in a test 
environment as much as possible, but now we have to deploy it and I want 
to be able to rewind very quickly to a known-good state.

So I adjusted your script a little.  It now reads like this:

-- snip --
#!/bin/sh

# Originally by Bjoern Steinbrink, simplified by Johannes Schindelin

inotifywait -m -r --exclude ^\./\.git/.* \
        -e close_write -e move -e create -e delete . 2>/dev/null |
while read FILE_PATH EVENT FILE_NAME
do
        FILE_NAME="$FILE_PATH$FILE_NAME"
        FILE_NAME=${FILE_NAME#./}

        # git doesn't care about directories
        test -d "$FILE_NAME" && continue

        case "$EVENT" in
        *MOVED_TO*|*CREATE*)
                git add "$FILE_NAME"
                git commit -m "$FILE_NAME created"
                ;;
        *CLOSE_WRITE*|*MODIFY*)
                git add "$FILE_NAME"
                git commit -m "$FILE_NAME changed"
                ;;
        *DELETE*|*MOVED_FROM*)
                git rm --cached "$FILE_NAME"
                git commit -m "$FILE_NAME removed"
                ;;
        esac
done
-- snap --

Thanks for your original script!

Ciao,
Dscho

  reply	other threads:[~2009-08-28 12:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-29 15:52 git guidance Jing Xue
2007-11-29 16:19 ` Linus Torvalds
2007-12-01  6:50   ` Al Boldi
2007-12-04 22:21     ` Phillip Susi
2007-12-07 17:35       ` Al Boldi
2007-12-06 18:24         ` Andreas Ericsson
2007-12-07 18:55           ` Al Boldi
2007-12-06 20:22             ` Johannes Schindelin
2007-12-07  4:37               ` Al Boldi
2007-12-07  8:40                 ` Andreas Ericsson
2007-12-07 10:53                   ` Al Boldi
2007-12-07 11:47                     ` Jakub Narebski
2007-12-07 19:04                       ` Al Boldi
2007-12-07 19:36                         ` Valdis.Kletnieks
2007-12-07 22:07                           ` Luke Lu
2007-12-08  4:56                           ` Al Boldi
2007-12-08  5:16                             ` Valdis.Kletnieks
2007-12-08 10:41                               ` Al Boldi
2007-12-08 11:13                         ` Johannes Schindelin
2007-12-07 12:30                     ` Andreas Ericsson
2007-12-07 21:17                     ` david
2007-12-07 22:00                     ` Björn Steinbrink
2009-08-28 12:30                       ` Johannes Schindelin [this message]
2007-12-06 21:46             ` Phillip Susi
2007-12-08  6:33     ` Martin Langhoff

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=alpine.DEB.1.00.0908281424100.7434@intel-tinevez-2-302 \
    --to=johannes.schindelin@gmx.de \
    --cc=B.Steinbrink@gmx.de \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.