git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-cvsserver: run post-update hook *after* update.

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 29, 2009, 22:48 UTC
Message-ID
<7v3af1enkq.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1233266282-8010-1-git-send-email-stefan.karpinski@gmail.com>
Stefan Karpinski <stefan.karpinski@gmail.com> writes:
Show 28 quoted lines
> CVS server was running the hook before the update action was
> actually done. This performs the update before the hook is called.
>
> The original commit that introduced the current incorrect behavior
> was 394d66d "git-cvsserver runs hooks/post-update". The error in
> ordering of the hook call appears to have gone unnoticed, but since
> git-cvsserver is supposed to emulate receive-pack, it stands to
> reason that the hook should be run *after* the update. Since this
> behavior is inconsistent with recieve-pack, users are either:
>
>   1) not using post-update hooks with git-cvsserver;
>   2) using post-update hooks that don't care whether they are
>      called before or after the actual update occurs;
>   3) using post-update hooks *only* with git-cvsserver, and
>      relying on the hook being called just before the update.
>
> This patch would affect only users in case 3. These users are
> depending on fairly obviously wrong behavior, and moreover they can
> simply change their current post-update into post-recieve hooks,
> and their systems will work correctly again.
>
> Signed-off-by: Stefan Karpinski <stefan.karpinski@gmail.com>
> ---
> I'm CCing Andy Parkins, Michael Witten, and Junio Hamano, who
> authored the other three commits implementing or affecting hooks in
> git-cvsserver (394d66d, cdf6328, b2741f6). If you could please take
> a look at this patch and comment on if it's harmful or not, it
> would be much appreciated.

I think I've seen this one before and I thought it was a sensible thing to do (and perhaps I even said so here).

Is this a resend? If so, let's queue it in at least 'next' and see if anybody screams ;-). For a program near the fringe like cvsserver, not many people run it but the small number of people who run it gets hurt rather quickly if the updated behaviour breaks their existing practice, and sometimes breaking things for them would be the only way to extract any response. Yes, it is very unfortunate.

Show 26 quoted lines
>  git-cvsserver.perl |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/git-cvsserver.perl b/git-cvsserver.perl
> index c1e09ea..d2e6003 100755
> --- a/git-cvsserver.perl
> +++ b/git-cvsserver.perl
> @@ -1413,14 +1413,14 @@ sub req_ci
>  		close $pipe || die "bad pipe: $! $?";
>  	}
>  
> +    $updater->update();
> +
>  	### Then hooks/post-update
>  	$hook = $ENV{GIT_DIR}.'hooks/post-update';
>  	if (-x $hook) {
>  		system($hook, "refs/heads/$state->{module}");
>  	}
>  
> -    $updater->update();
> -
>      # foreach file specified on the command line ...
>      foreach my $filename ( @committedfiles )
>      {
> -- 
> 1.6.0.3.3.g08dd8
Previous: Stefan KarpinskiNext: Stefan Karpinski
Message 4 of 12 in “Re: [PATCH] git-cvsserver: run post-update hook *after* update.”
  1. Stefan KarpinskiJan 23, 2009
  2. Junio C HamanoJan 23, 2009
  3. git-cvsserver: run post-update hook *after* update.Stefan Karpinski, Jan 29, 2009
  4. Junio C HamanoJan 29, 2009
  5. Stefan KarpinskiJan 29, 2009
  6. Andy ParkinsJan 29, 2009
  7. git-cvsserver: handle CVS 'noop' command.Stefan Karpinski, Jan 29, 2009
  8. Junio C HamanoJan 29, 2009
  9. Stefan KarpinskiJan 29, 2009
  10. Junio C HamanoJan 29, 2009
  11. git-cvsserver: handle CVS 'noop' command.Stefan Karpinski, Jan 30, 2009
  12. Martin LanghoffJan 30, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.