git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Lodato <lodatom@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Ron Garret <ron1@flownet.com>, git@vger.kernel.org
Subject: Re: Individual file snapshots
Date: Sat, 13 Feb 2010 10:13:45 -0500	[thread overview]
Message-ID: <ca433831002130713i5b015686k9f53911954858845@mail.gmail.com> (raw)
In-Reply-To: <7v6362c672.fsf@alter.siamese.dyndns.org>

On Fri, Feb 12, 2010 at 7:47 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Mark Lodato <lodatom@gmail.com> writes:
>
>> The basic steps are:
>>
>> backup .git/index
>> git add -a
>> git write-tree
>> git commit-tree
>> restore .git/index
>
> Instead of doing that, you might want to consider
>
>        GIT_INDEX_FILE=...some-temporary-file...
>        export GIT_INDEX_FILE
>
> and run everything as if that is the index throughout your script.  That
> way, if your script ever failed in the middle, you won't have to worry
> about a broken index file.

In the actual script, I copied the index file back if any error
occured.  Still, your idea sounds better, so I just updated it to use
this variable instead.  I still remove the temporary file on error,
but if something goes wrong, at least the index won't be hosed.


On Sat, Feb 13, 2010 at 2:01 AM, Ron Garret <ron1@flownet.com> wrote:
> Moving the index around seems kinda hacky.  You probably want git-mktree.

git-mktree is way too complicated.  I would have to parse the index
and call git-mktree for each directory.  There is already a program to
do this: git-write-tree :)  Besides, using GIT_INDEX_FILE as suggested
by Junio allows me to leave the original index file intact.

--
Mark

  reply	other threads:[~2010-02-13 15:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-12 12:03 Individual file snapshots Ron Garret
2010-02-12 12:18 ` Peter Krefting
2010-02-12 17:24   ` Ron Garret
2010-02-12 20:41 ` René Scharfe
2010-02-12 21:25   ` Ron Garret
2010-02-12 21:37     ` Brian Gernhardt
2010-02-12 21:57       ` Ron Garret
2010-02-12 22:14         ` Junio C Hamano
2010-02-12 22:41           ` Ron Garret
2010-02-12 22:32         ` Brian Gernhardt
2010-02-12 22:39           ` Ron Garret
2010-02-13  0:33             ` Mark Lodato
2010-02-13  0:47               ` Junio C Hamano
2010-02-13 15:13                 ` Mark Lodato [this message]
2010-02-13 18:41                   ` Ron Garret
2010-02-13 18:58                   ` Junio C Hamano
2010-02-13  7:01               ` Ron Garret
2010-02-13  3:00         ` Larry D'Anna

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=ca433831002130713i5b015686k9f53911954858845@mail.gmail.com \
    --to=lodatom@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ron1@flownet.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).