git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cvsserver: imitate git-update-ref when committing
@ 2006-07-26 20:51 Johannes Schindelin
  2006-07-27  0:21 ` Shawn Pearce
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin @ 2006-07-26 20:51 UTC (permalink / raw)
  To: git, junkio, Martin Langhoff


git-update-ref writes into the lockfile, and renames it afterwards. Like 
commit v1.3.0-rc3~22, it is not only cleaner, but also helps with shared 
setups: every developer can have a different primary group; what matters 
is that $GIT_DIR/refs/heads has to be writable by a group you are in.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 git-cvsserver.perl |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 1b70cd9..2c1b0c7 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -1144,9 +1144,7 @@ sub req_ci
         exit;
     }
 
-    open FILE, ">", "$ENV{GIT_DIR}refs/heads/$state->{module}";
-    print FILE $commithash;
-    close FILE;
+    print LOCKFILE $commithash;
 
     $updater->update();
 
@@ -1173,7 +1171,9 @@ sub req_ci
     }
 
     close LOCKFILE;
-    unlink($lockfile);
+    my $reffile = "$ENV{GIT_DIR}refs/heads/$state->{module}";
+    unlink($reffile);
+    rename($lockfile, $reffile);
     chdir "/";
 
     print "ok\n";
-- 
1.4.2.rc2.g2b3d-dirty

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

* Re: [PATCH] cvsserver: imitate git-update-ref when committing
  2006-07-26 20:51 [PATCH] cvsserver: imitate git-update-ref when committing Johannes Schindelin
@ 2006-07-27  0:21 ` Shawn Pearce
  2006-07-27  8:53   ` Johannes Schindelin
  0 siblings, 1 reply; 3+ messages in thread
From: Shawn Pearce @ 2006-07-27  0:21 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

You might want to also consider appending to the reflog, if it
exists/is enabled.  I still need to get upload-pack to do this but it
may be useful for some heads for some people...  or maybe not.  :-)

Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> 
> git-update-ref writes into the lockfile, and renames it afterwards. Like 
> commit v1.3.0-rc3~22, it is not only cleaner, but also helps with shared 
> setups: every developer can have a different primary group; what matters 
> is that $GIT_DIR/refs/heads has to be writable by a group you are in.
> 
> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> ---
>  git-cvsserver.perl |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/git-cvsserver.perl b/git-cvsserver.perl
> index 1b70cd9..2c1b0c7 100755
> --- a/git-cvsserver.perl
> +++ b/git-cvsserver.perl
> @@ -1144,9 +1144,7 @@ sub req_ci
>          exit;
>      }
>  
> -    open FILE, ">", "$ENV{GIT_DIR}refs/heads/$state->{module}";
> -    print FILE $commithash;
> -    close FILE;
> +    print LOCKFILE $commithash;
>  
>      $updater->update();
>  
> @@ -1173,7 +1171,9 @@ sub req_ci
>      }
>  
>      close LOCKFILE;
> -    unlink($lockfile);
> +    my $reffile = "$ENV{GIT_DIR}refs/heads/$state->{module}";
> +    unlink($reffile);
> +    rename($lockfile, $reffile);
>      chdir "/";
>  
>      print "ok\n";
> -- 
> 1.4.2.rc2.g2b3d-dirty

-- 
Shawn.

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

* Re: [PATCH] cvsserver: imitate git-update-ref when committing
  2006-07-27  0:21 ` Shawn Pearce
@ 2006-07-27  8:53   ` Johannes Schindelin
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Schindelin @ 2006-07-27  8:53 UTC (permalink / raw)
  To: Shawn Pearce; +Cc: git

Hi,

On Wed, 26 Jul 2006, Shawn Pearce wrote:

> You might want to also consider appending to the reflog, if it exists/is 
> enabled.

Given that I do not use it, and do not really understand what it does, 
this would be a bad idea ;-)

Ciao,
Dscho

P.S.: How's your Java thing coming along?

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

end of thread, other threads:[~2006-07-27  8:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-26 20:51 [PATCH] cvsserver: imitate git-update-ref when committing Johannes Schindelin
2006-07-27  0:21 ` Shawn Pearce
2006-07-27  8:53   ` 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).