{"thread":{"id":"8278","subject":"[PATCH] make git-cvsimport work on ref-packed repositories","startedAt":"2007-05-23T07:13:28Z","lastAt":"2007-05-23T18:06:24Z","messageCount":4,"participants":["Stephan Springl","Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"43023","messageId":"Pine.LNX.4.64.0705230909310.25524@lar.bfw.de","threadId":"8278","inReplyTo":null,"subject":"[PATCH] make git-cvsimport work on ref-packed repositories","fromName":"Stephan Springl","fromEmail":"springl-git@bfw-online.de","sentAt":"2007-05-23T07:13:28Z","receivedAt":"2007-05-23T07:13:28Z","isPatch":true,"sender":{"key":"springl-git@bfw-online.de","avatar":null},"body":"Hi!\n\n      This helps us to use git-cvsimport on our ref-packed repositories.\nMaybe you want to use this or a similar solution to be integrated in\nstock git.\n\nThank you.\n\nStephan.\n\n\n\ncommit 83f8922f1ad385ef3493684838e11a34edbf68a7\nAuthor: Stephan Springl <springl-git@bfw-online.de>\nDate:   Wed May 23 09:06:37 2007 +0200\n\n     Use git-for-each-ref to check whether the origin (or opt_o) branch exists.\n     This works in repositories that have their refs packed by\n     \"git-pack-refs --all --prune\" whereas testing the file\n     $git_dir/refs/heads/$opt_o does not.\n\ndiff --git a/git-cvsimport.perl b/git-cvsimport.perl\nindex ac74bc5..f68afe7 100755\n--- a/git-cvsimport.perl\n+++ b/git-cvsimport.perl\n@@ -559,11 +559,6 @@ unless (-d $git_dir) {\n  \t$last_branch = $opt_o;\n  \t$orig_branch = \"\";\n  } else {\n-\t-f \"$git_dir/refs/heads/$opt_o\"\n-\t\tor die \"Branch '$opt_o' does not exist.\\n\".\n-\t\t       \"Either use the correct '-o branch' option,\\n\".\n-\t\t       \"or import to a new repository.\\n\";\n-\n  \topen(F, \"git-symbolic-ref HEAD |\") or\n  \t\tdie \"Cannot run git-symbolic-ref: $!\\n\";\n  \tchomp ($last_branch = <F>);\n@@ -588,6 +583,11 @@ unless (-d $git_dir) {\n  \t\t$branch_date{$head} = $1;\n  \t}\n  \tclose(H);\n+        if (!exists $branch_date{$opt_o}) {\n+\t\tdie \"Branch '$opt_o' does not exist.\\n\".\n+\t\t       \"Either use the correct '-o branch' option,\\n\".\n+\t\t       \"or import to a new repository.\\n\";\n+        }\n  }\n\n  -d $git_dir\n\n\n--\nStephan Springl                           BFW Werner Völk GmbH\nspringl-git@bfw-online.de                 Energiemesstechnik & Service\n+49 89 82917-452                          Drosselgasse 5\n                                           82166 Gräfelfing/München"},{"id":"43026","messageId":"Pine.LNX.4.64.0705231153000.4113@racer.site","threadId":"8278","inReplyTo":"Pine.LNX.4.64.0705230909310.25524@lar.bfw.de","subject":"[PATCH] Use git-for-each-ref to check whether the origin branch exists.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-05-23T11:13:21Z","receivedAt":"2007-05-23T11:13:21Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Stephan Springl <springl-git@bfw-online.de>\n\nThis works in repositories that have their refs packed by\n\"git-pack-refs --all --prune\" whereas testing the file\n$git_dir/refs/heads/$opt_o does not.\n\nAcked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n\tOn Wed, 23 May 2007, Stephan Springl wrote:\n\t\n\t> This helps us to use git-cvsimport on our ref-packed \n\t> repositories.\n\n\tDefault for ref-packed repositories is to pack only the tags, \n\ttherefore you usually do not need this patch. However, it looks \n\tobviously correct to me. A cursory test also showed that it does \n\tnot break anything.\n\n\t> Maybe you want to use this or a similar solution to be \n\t> integrated in stock git.\n\t\n\tUnfortunately your patch is white-space corrupted (it has an extra \n\tspace on all lines starting with a space, it seems). Therefore I \n\tredid it with this email.\n\n\tIt would be nice to follow Documentation/SubmittingPatches next \n\ttime. For example, I guess that you want to sign off on it...\n\n git-cvsimport.perl |   10 +++++-----\n 1 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/git-cvsimport.perl b/git-cvsimport.perl\nindex ac74bc5..f68afe7 100755\n--- a/git-cvsimport.perl\n+++ b/git-cvsimport.perl\n@@ -559,11 +559,6 @@ unless (-d $git_dir) {\n \t$last_branch = $opt_o;\n \t$orig_branch = \"\";\n } else {\n-\t-f \"$git_dir/refs/heads/$opt_o\"\n-\t\tor die \"Branch '$opt_o' does not exist.\\n\".\n-\t\t       \"Either use the correct '-o branch' option,\\n\".\n-\t\t       \"or import to a new repository.\\n\";\n-\n \topen(F, \"git-symbolic-ref HEAD |\") or\n \t\tdie \"Cannot run git-symbolic-ref: $!\\n\";\n \tchomp ($last_branch = <F>);\n@@ -588,6 +583,11 @@ unless (-d $git_dir) {\n \t\t$branch_date{$head} = $1;\n \t}\n \tclose(H);\n+        if (!exists $branch_date{$opt_o}) {\n+\t\tdie \"Branch '$opt_o' does not exist.\\n\".\n+\t\t       \"Either use the correct '-o branch' option,\\n\".\n+\t\t       \"or import to a new repository.\\n\";\n+        }\n }\n \n -d $git_dir\n-- \n1.5.2.2527.ga2df\n"},{"id":"43028","messageId":"Pine.LNX.4.64.0705231351220.19399@lar.bfw.de","threadId":"8278","inReplyTo":"Pine.LNX.4.64.0705231153000.4113@racer.site","subject":"Re: [PATCH] Use git-for-each-ref to check whether the origin branch exists.","fromName":"Stephan Springl","fromEmail":"springl-git@bfw-online.de","sentAt":"2007-05-23T11:59:29Z","receivedAt":"2007-05-23T11:59:29Z","isPatch":true,"sender":{"key":"springl-git@bfw-online.de","avatar":null},"body":"On Wed, 23 May 2007, Johannes Schindelin wrote:\n\n> From: Stephan Springl <springl-git@bfw-online.de>\n> This works in repositories that have their refs packed by\n> \"git-pack-refs --all --prune\" whereas testing the file\n> $git_dir/refs/heads/$opt_o does not.\n>\n> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n>  Unfortunately your patch is white-space corrupted (it has an extra\n>  space on all lines starting with a space, it seems). Therefore I\n>  redid it with this email.\nSorry for that especially as we are very very strict with whitespace and \ncoding conventions in our own development ... arrg. Thanks anyway.\n\nStephan\n"},{"id":"43041","messageId":"7vlkff2z4v.fsf@assigned-by-dhcp.cox.net","threadId":"8278","inReplyTo":"Pine.LNX.4.64.0705231153000.4113@racer.site","subject":"Re: [PATCH] Use git-for-each-ref to check whether the origin branch exists.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-23T18:06:24Z","receivedAt":"2007-05-23T18:06:24Z","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> \tDefault for ref-packed repositories is to pack only the tags, \n> \ttherefore you usually do not need this patch. However, it looks \n> \tobviously correct to me. A cursory test also showed that it does \n> \tnot break anything.\n>\n> \t> Maybe you want to use this or a similar solution to be \n> \t> integrated in stock git.\n> \t\n> \tUnfortunately your patch is white-space corrupted (it has an extra \n> \tspace on all lines starting with a space, it seems). Therefore I \n> \tredid it with this email.\n>\n> \tIt would be nice to follow Documentation/SubmittingPatches next \n> \ttime. For example, I guess that you want to sign off on it...\n\nThanks both.\n"}]}