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

[PATCH/RFT] cvsserver: only allow checkout of branches

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Oct 4, 2007, 15:29 UTC
Message-ID
<Pine.LNX.4.64.0710041622070.4174@racer.site>
In-Reply-To
<200710041506.13154.wielemak@science.uva.nl>
It does not make sense to check out tags or "HEAD".
Noticed by Jan Wielemaker.
---
	On Thu, 4 Oct 2007, Jan Wielemaker wrote:
	> On Thursday 04 October 2007 14:56, Johannes Schindelin wrote:
	>
	> > Ah!  Did you do "CVSROOT=:ext:blablub cvs co HEAD"?
	> 
	> Yip ...
	> 
	> > You should "co master".  The branches in git are the modules 
	> > in cvs.
	> >
	> > HEAD is too volatile, you cannot make a proper module from it 
	> > (imagine for example "git checkout next" where "next" is a 
	> > branch, followed by "git checkout html", where "html" is 
	> > another branch).
	> 
	> Ok.  Pretty sure I got literal HEAD from one of the examples 
	> somewhere ... Or, I've been blind all along.  Anyway, the 
	> maintainer may consider giving an error when trying to access 
	> HEAD as a module.  Would have saved about 2 days work and its 
	> unlikely I'm the last victim :-(
	This patch is completely untested.  Could you try it, please?
	If it works:
	Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
	Cc'ed Frank, who is de-facto maintainer (according to shortlog) 
	and Martin, who started it all IIRC.
 git-cvsserver.perl |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 13dbd27..869690c 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -770,6 +770,14 @@ sub req_co
 
     $log->debug("req_co : " . ( defined($data) ? $data : "[NULL]" ) );
 
+    if( system("git", "rev-parse", "--verify", "refs/heads/$module" ) != 0 )
+    {
+	$log->warn("Checkout failed: $module is not a branch");
+	print "error 1 Checkout failed: $module is not a branch\n";
+	chdir "/";
+	exit;
+    }
+
     $log->info("Checking out module '$module' ($state->{CVSROOT}) to '$checkout_path'");
 
     $ENV{GIT_DIR} = $state->{CVSROOT} . "/";
Previous: Jan WielemakerNext: Frank Lichtenheld
Message 11 of 19 in “git-cvsserver commit trouble (unexpected end of file in client)”
  1. Jan WielemakerOct 3, 2007
  2. Jan WielemakerOct 3, 2007
  3. Jan WielemakerOct 3, 2007
  4. Johannes SchindelinOct 3, 2007
  5. Jan WielemakerOct 3, 2007
  6. Johannes SchindelinOct 3, 2007
  7. Jan WielemakerOct 4, 2007
  8. Jan WielemakerOct 4, 2007
  9. Johannes SchindelinOct 4, 2007
  10. Jan WielemakerOct 4, 2007
  11. cvsserver: only allow checkout of branchesJohannes Schindelin, Oct 4, 2007
  12. Frank LichtenheldOct 4, 2007
  13. Johannes SchindelinOct 4, 2007
  14. Jan WielemakerOct 4, 2007
  15. Johannes SchindelinOct 4, 2007
  16. Frank LichtenheldOct 4, 2007
  17. Frank LichtenheldOct 4, 2007
  18. Johannes SchindelinOct 4, 2007
  19. Shawn O. PearceOct 4, 2007

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.