git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* use GIT_DIR instead of /var/tmp
@ 2006-01-05 11:52 Alex Riesen
  2006-01-05 16:38 ` H. Peter Anvin
  2006-01-05 16:42 ` Linus Torvalds
  0 siblings, 2 replies; 8+ messages in thread
From: Alex Riesen @ 2006-01-05 11:52 UTC (permalink / raw)
  To: Junio C Hamano, git

[-- Attachment #1: Type: text/plain, Size: 203 bytes --]

Not every system (will not one microsoft windows system) have /var/tmp,
whereas using GIT_DIR for random temporary files is more or less established.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>

[-- Attachment #2: 0006-use-GIT_DIR-instead-of-var-tmp.txt --]
[-- Type: text/plain, Size: 531 bytes --]

Subject: [PATCH] use GIT_DIR instead of /var/tmp

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>


---

 git-reset.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

9ba3fa786e3de644a9395f99e69cede912f64571
diff --git a/git-reset.sh b/git-reset.sh
index eb44ee8..6c9e58a 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -3,7 +3,7 @@
 USAGE='[--mixed | --soft | --hard]  [<commit-ish>]'
 . git-sh-setup
 
-tmp=/var/tmp/reset.$$
+tmp=${GIT_DIR}/reset.$$
 trap 'rm -f $tmp-*' 0 1 2 3 15
 
 reset_type=--mixed
-- 
1.0.GIT

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: use GIT_DIR instead of /var/tmp
  2006-01-05 11:52 use GIT_DIR instead of /var/tmp Alex Riesen
@ 2006-01-05 16:38 ` H. Peter Anvin
  2006-01-05 16:47   ` Alex Riesen
  2006-01-05 16:42 ` Linus Torvalds
  1 sibling, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2006-01-05 16:38 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Junio C Hamano, git

Alex Riesen wrote:
> Not every system (will not one microsoft windows system) have /var/tmp,
> whereas using GIT_DIR for random temporary files is more or less established.

Depends on what you're doing.  Only if you're writing to the repository.

Windows will usually have $TMP and/or $TEMP, a lot of Unix apps honour 
$TMP_DIR.

	-hpa

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: use GIT_DIR instead of /var/tmp
  2006-01-05 11:52 use GIT_DIR instead of /var/tmp Alex Riesen
  2006-01-05 16:38 ` H. Peter Anvin
@ 2006-01-05 16:42 ` Linus Torvalds
  2006-01-05 16:49   ` Jon Nelson
  1 sibling, 1 reply; 8+ messages in thread
From: Linus Torvalds @ 2006-01-05 16:42 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Junio C Hamano, git



On Thu, 5 Jan 2006, Alex Riesen wrote:
>
> Not every system (will not one microsoft windows system) have /var/tmp,
> whereas using GIT_DIR for random temporary files is more or less established.

Note that in this case it might be appropriate, but in general you should 
be careful. You may want to access a git directory without actually having 
write permissions to it. 

Of course, for "git reset" that's not an issue (since it needs write 
permissions anyway), but just in general.. git programs mostly use pipes 
to communicate, and temporary files are pretty rare, so we hopefully don't 
have that issue much, but let's make sure that things that just look at a 
repository can work even with a read-only repo.

		Linus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: use GIT_DIR instead of /var/tmp
  2006-01-05 16:38 ` H. Peter Anvin
@ 2006-01-05 16:47   ` Alex Riesen
  2006-01-05 17:07     ` H. Peter Anvin
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Riesen @ 2006-01-05 16:47 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Junio C Hamano, git

On 1/5/06, H. Peter Anvin <hpa@zytor.com> wrote:
> > Not every system (will not one microsoft windows system) have /var/tmp,
> > whereas using GIT_DIR for random temporary files is more or less established.
>
> Depends on what you're doing.  Only if you're writing to the repository.
>
> Windows will usually have $TMP and/or $TEMP, a lot of Unix apps honour
> $TMP_DIR.

Well, it never had TMP/TEMP by default for me (though I'd expect from people
installing git to set the thing properly), and it is usually undefined
everywhere else.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: use GIT_DIR instead of /var/tmp
  2006-01-05 16:42 ` Linus Torvalds
@ 2006-01-05 16:49   ` Jon Nelson
  2006-01-06  9:32     ` Alex Riesen
  0 siblings, 1 reply; 8+ messages in thread
From: Jon Nelson @ 2006-01-05 16:49 UTC (permalink / raw)
  Cc: git

On Thu, 5 Jan 2006, Linus Torvalds wrote:

> 
> 
> On Thu, 5 Jan 2006, Alex Riesen wrote:
> >
> > Not every system (will not one microsoft windows system) have /var/tmp,
> > whereas using GIT_DIR for random temporary files is more or less established.
> 
> Note that in this case it might be appropriate, but in general you should 
> be careful. You may want to access a git directory without actually having 
> write permissions to it. 
> 
> Of course, for "git reset" that's not an issue (since it needs write 
> permissions anyway), but just in general.. git programs mostly use pipes 
> to communicate, and temporary files are pretty rare, so we hopefully don't 
> have that issue much, but let's make sure that things that just look at a 
> repository can work even with a read-only repo.

Do you still need write access to $GIT_DIR if $GIT_INDEX_FILE is set to 
some place outside of $GIT_DIR?

--
Jon Nelson <jnelson-git@jamponi.net>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: use GIT_DIR instead of /var/tmp
  2006-01-05 16:47   ` Alex Riesen
@ 2006-01-05 17:07     ` H. Peter Anvin
  0 siblings, 0 replies; 8+ messages in thread
From: H. Peter Anvin @ 2006-01-05 17:07 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Junio C Hamano, git

Alex Riesen wrote:
> On 1/5/06, H. Peter Anvin <hpa@zytor.com> wrote:
> 
>>>Not every system (will not one microsoft windows system) have /var/tmp,
>>>whereas using GIT_DIR for random temporary files is more or less established.
>>
>>Depends on what you're doing.  Only if you're writing to the repository.
>>
>>Windows will usually have $TMP and/or $TEMP, a lot of Unix apps honour
>>$TMP_DIR.
> 
> 
> Well, it never had TMP/TEMP by default for me (though I'd expect from people
> installing git to set the thing properly), and it is usually undefined
> everywhere else.

Well, for me it's set to

TEMP=C:\Documents and Settings\user\Local Settings\Temp

(except it's all in 8.3-mangled form)... and I sure as Hades didn't set 
it.  This in on XP SP2.  "Local Settings" is a hidden directory which 
seems to have stuff like the Internet Exploder cache in it.

	-hpa

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: use GIT_DIR instead of /var/tmp
  2006-01-05 16:49   ` Jon Nelson
@ 2006-01-06  9:32     ` Alex Riesen
  2006-01-06 10:00       ` Johannes Schindelin
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Riesen @ 2006-01-06  9:32 UTC (permalink / raw)
  To: Jon Nelson; +Cc: Linus Torvalds, junio, git

Jon Nelson, Thu, Jan 05, 2006 17:49:36 +0100:
> Do you still need write access to $GIT_DIR if $GIT_INDEX_FILE is set to 
> some place outside of $GIT_DIR?

yes, $GIT_DIR/refs/heads/ref-pointed-by-HEAD is updated by git-reset.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: use GIT_DIR instead of /var/tmp
  2006-01-06  9:32     ` Alex Riesen
@ 2006-01-06 10:00       ` Johannes Schindelin
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Schindelin @ 2006-01-06 10:00 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git

Hi,

On Fri, 6 Jan 2006, Alex Riesen wrote:

> Jon Nelson, Thu, Jan 05, 2006 17:49:36 +0100:
> > Do you still need write access to $GIT_DIR if $GIT_INDEX_FILE is set to 
> > some place outside of $GIT_DIR?
> 
> yes, $GIT_DIR/refs/heads/ref-pointed-by-HEAD is updated by git-reset.

In a strict sense, this means write access to $GIT_DIR/refs/heads/. In a 
shared setup, I have repositories where all developers are allowed to 
write to that folder, but only the repo maintainer (yours truly) is 
allowed to write to $GIT_DIR (which effectively means: nobody can write 
an index).

Maybe the safe method would be to introduce $GIT_TMP_DIR, with "/tmp/" 
being the default?

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-01-06 10:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-05 11:52 use GIT_DIR instead of /var/tmp Alex Riesen
2006-01-05 16:38 ` H. Peter Anvin
2006-01-05 16:47   ` Alex Riesen
2006-01-05 17:07     ` H. Peter Anvin
2006-01-05 16:42 ` Linus Torvalds
2006-01-05 16:49   ` Jon Nelson
2006-01-06  9:32     ` Alex Riesen
2006-01-06 10:00       ` Johannes Schindelin

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).