{"thread":{"id":"3755","subject":"[PATCH] cvsimport: use git-update-ref when updating","startedAt":"2006-03-30T12:06:15Z","lastAt":"2006-03-31T11:14:45Z","messageCount":5,"participants":["Johannes Schindelin","Junio C Hamano","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"18144","messageId":"Pine.LNX.4.63.0603301405160.18852@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"3755","inReplyTo":null,"subject":"[PATCH] cvsimport: use git-update-ref when updating","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-03-30T12:06:15Z","receivedAt":"2006-03-30T12:06:15Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThis simplifies code, and also fixes a subtle bug: when importing in a\nshared repository, where another user last imported from CVS, cvsimport\nused to complain that it could not open <branch> for update.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n git-cvsimport.perl |    7 ++-----\n 1 files changed, 2 insertions(+), 5 deletions(-)\n\ndiff --git a/git-cvsimport.perl b/git-cvsimport.perl\nindex 3728294..957af13 100755\n--- a/git-cvsimport.perl\n+++ b/git-cvsimport.perl\n@@ -15,6 +15,7 @@ # You can change that with the '-o' opti\n \n use strict;\n use warnings;\n+use Fcntl;\n use Getopt::Std;\n use File::Spec;\n use File::Temp qw(tempfile);\n@@ -677,11 +678,7 @@ my $commit = sub {\n \twaitpid($pid,0);\n \tdie \"Error running git-commit-tree: $?\\n\" if $?;\n \n-\topen(C,\">$git_dir/refs/heads/$branch\")\n-\t\tor die \"Cannot open branch $branch for update: $!\\n\";\n-\tprint C \"$cid\\n\"\n-\t\tor die \"Cannot write branch $branch for update: $!\\n\";\n-\tclose(C)\n+\tsystem(\"git-update-ref refs/heads/$branch $cid\") == 0\n \t\tor die \"Cannot write branch $branch for update: $!\\n\";\n \n \tif($tag) {\n"},{"id":"18165","messageId":"7vk6ab1iy2.fsf@assigned-by-dhcp.cox.net","threadId":"3755","inReplyTo":"Pine.LNX.4.63.0603301405160.18852@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] cvsimport: use git-update-ref when updating","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-03-31T01:50:13Z","receivedAt":"2006-03-31T01:50:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> This simplifies code, and also fixes a subtle bug: when importing in a\n> shared repository, where another user last imported from CVS, cvsimport\n> used to complain that it could not open <branch> for update.\n\nThe second hunk look sensible but I do not know about \"use Fcntl\"\nsince I do not see anything you are adding that starts to use it...\n"},{"id":"18175","messageId":"Pine.LNX.4.63.0603311207270.20122@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"3755","inReplyTo":"7vk6ab1iy2.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] cvsimport: use git-update-ref when updating","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-03-31T10:08:11Z","receivedAt":"2006-03-31T10:08:11Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 30 Mar 2006, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > This simplifies code, and also fixes a subtle bug: when importing in a\n> > shared repository, where another user last imported from CVS, cvsimport\n> > used to complain that it could not open <branch> for update.\n> \n> The second hunk look sensible but I do not know about \"use Fcntl\"\n> since I do not see anything you are adding that starts to use it...\n\nO_EXCL. Without \"use Fcntl;\" perl says I am not allowed to use bareword \nthings in strict mode or some such.\n\nCiao,\nDscho\n"},{"id":"18176","messageId":"20060331103230.GB15159@hand.yhbt.net","threadId":"3755","inReplyTo":"Pine.LNX.4.63.0603311207270.20122@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] cvsimport: use git-update-ref when updating","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-03-31T10:32:30Z","receivedAt":"2006-03-31T10:32:30Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> Hi,\n> \n> On Thu, 30 Mar 2006, Junio C Hamano wrote:\n> \n> > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> > \n> > > This simplifies code, and also fixes a subtle bug: when importing in a\n> > > shared repository, where another user last imported from CVS, cvsimport\n> > > used to complain that it could not open <branch> for update.\n> > \n> > The second hunk look sensible but I do not know about \"use Fcntl\"\n> > since I do not see anything you are adding that starts to use it...\n> \n> O_EXCL. Without \"use Fcntl;\" perl says I am not allowed to use bareword \n> things in strict mode or some such.\n\nHuh?  I still don't see where O_EXCL is used.\n\n> > > +       system(\"git-update-ref refs/heads/$branch $cid\") == 0\n\nPassing args to system() in list form is always preferable in case\nthere's a shell-unfriendly variable:\n\n\tsystem(\"git-update-ref\", \"refs/heads/$branch\", $cid) == 0\n\n-- \nEric Wong\n"},{"id":"18177","messageId":"Pine.LNX.4.63.0603311310580.23287@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"3755","inReplyTo":"20060331103230.GB15159@hand.yhbt.net","subject":"Re: [PATCH] cvsimport: use git-update-ref when updating","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-03-31T11:14:45Z","receivedAt":"2006-03-31T11:14:45Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 31 Mar 2006, Eric Wong wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> > Hi,\n> > \n> > On Thu, 30 Mar 2006, Junio C Hamano wrote:\n> > \n> > > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> > > \n> > > > This simplifies code, and also fixes a subtle bug: when importing in a\n> > > > shared repository, where another user last imported from CVS, cvsimport\n> > > > used to complain that it could not open <branch> for update.\n> > > \n> > > The second hunk look sensible but I do not know about \"use Fcntl\"\n> > > since I do not see anything you are adding that starts to use it...\n> > \n> > O_EXCL. Without \"use Fcntl;\" perl says I am not allowed to use bareword \n> > things in strict mode or some such.\n> \n> Huh?  I still don't see where O_EXCL is used.\n\nYes. I did not make that point clear enough, I guess. My first approach \nwas to reimplement git-update-ref in perl, which worked well enough, until \nI remembered that you could just call programs from perl :-)\n\n> > > > +       system(\"git-update-ref refs/heads/$branch $cid\") == 0\n> \n> Passing args to system() in list form is always preferable in case\n> there's a shell-unfriendly variable:\n> \n> \tsystem(\"git-update-ref\", \"refs/heads/$branch\", $cid) == 0\n\nOld habit dies hard.\n\n---\n\n git-cvsimport.perl |    6 +-----\n 1 files changed, 1 insertions(+), 5 deletions(-)\n\ndiff --git a/git-cvsimport.perl b/git-cvsimport.perl\nindex 3728294..fe6298b 100755\n--- a/git-cvsimport.perl\n+++ b/git-cvsimport.perl\n@@ -677,11 +677,7 @@ my $commit = sub {\n \twaitpid($pid,0);\n \tdie \"Error running git-commit-tree: $?\\n\" if $?;\n \n-\topen(C,\">$git_dir/refs/heads/$branch\")\n-\t\tor die \"Cannot open branch $branch for update: $!\\n\";\n-\tprint C \"$cid\\n\"\n-\t\tor die \"Cannot write branch $branch for update: $!\\n\";\n-\tclose(C)\n+\tsystem(\"git-update-ref\", \"refs/heads/$branch\", $cid) == 0\n \t\tor die \"Cannot write branch $branch for update: $!\\n\";\n \n \tif($tag) {\n"}]}