git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: git@vger.kernel.org
Subject: [PATCH 0/2] Alternate index output file
Date: Sat, 31 Mar 2007 23:27:54 -0700	[thread overview]
Message-ID: <7v4po04nit.fsf_-_@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0703280759230.6730@woody.linux-foundation.org> (Linus Torvalds's message of "Wed, 28 Mar 2007 08:13:38 -0700 (PDT)")

Linus Torvalds <torvalds@linux-foundation.org> writes:

> (Looking at git-commit.sh, the thing I *really* think we should do is to 
> have a "GIT_INDEX_FILE_OUTPUT" environment variable that does locking on 
> the input file, but writes the result to another file: rigth now 
> git-commit.sh (a) wastes time copying the old index file by hand and (b) 
> as a result doesn't even honor any locking on it.

I've done this with an environment variable, and it passes all
the tests, but I think for this application an environment is
really a mistake.  As expected, the change to git-commit.sh
looks like:

        diff --git a/git-commit.sh b/git-commit.sh
        index 292cf96..20c0dc8 100755
        --- a/git-commit.sh
        +++ b/git-commit.sh
        @@ -370,8 +370,8 @@ t,)
                        # the same way.
                        if test -z "$initial_commit"
                        then
        -			cp "$THIS_INDEX" "$TMP_INDEX"
        -			GIT_INDEX_FILE="$TMP_INDEX" git-read-tree -i -m HEAD
        +			_GIT_INDEX_OUTPUT="$TMP_INDEX" \
        +			GIT_INDEX_FILE="$THIS_INDEX" git-read-tree -i -m HEAD
                        else
                                rm -f "$TMP_INDEX"
                        fi || exit

However, I had to say something like this in the documentation:

        diff --git a/Documentation/git.txt b/Documentation/git.txt
        index dceacfa..bc025d6 100644
        --- a/Documentation/git.txt
        +++ b/Documentation/git.txt
        @@ -311,6 +311,15 @@ git so take care if using Cogito etc.
                index file. If not specified, the default of `$GIT_DIR/index`
                is used.

        +'_GIT_INDEX_OUTPUT'::
        +	When this environment is defined, plumbing level
        +	commands that update the index writes the resulting
        +	index to this file, instead of the usual
        +	`GIT_INDEX_FILE` (or its default `$GIT_DIR/index`).
        +	This is solely meant to be used by Porcelain to drive
        +	low-level plumbing.  Defining this in user's environment
        +	is always an error.  Do not use it.
        +
         'GIT_OBJECT_DIRECTORY'::
                If the object storage directory is specified via this
                environment variable then the sha1 directories are created

If a curious user has the environment variable set to something
other than the file GIT_INDEX_FILE points at, almost everything
will break.  This should instead be a command line parameter to
tell these plumbing commands to write the result in the named
file, to prevent stupid mistakes.

  parent reply	other threads:[~2007-04-01  6:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-28  9:57 Sanity checking request Junio C Hamano
2007-03-28 15:13 ` Linus Torvalds
2007-03-28 19:38   ` Junio C Hamano
2007-04-01  6:27   ` Junio C Hamano [this message]
2007-04-01  6:29     ` [PATCH 1/2] _GIT_INDEX_OUTPUT: allow plumbing to output to an alternative index file Junio C Hamano
2007-04-01  6:29     ` [PATCH 2/2] git-read-tree --index-output=<file> Junio C Hamano
2007-04-01 16:08     ` [PATCH 0/2] Alternate index output file Linus Torvalds

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=7v4po04nit.fsf_-_@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 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).