Re: [PATCH] git-cvsimport: fix initial checkout
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 13, 2008, 23:15 UTC
- Message-ID
- <7vr6eew70a.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <47D9A836.9010601@catalyst.net.nz>
Martin Langhoff <martin@catalyst.net.nz> writes:
Show 22 quoted lines
> Marc-Andre Lureau wrote:
>> git-symbolic-ref HEAD returns master reference, even if the file does
>> not exists. That prevents the initial checkout and fails in
>> git-rev-parse.
>
> But you are patching the block that gets triggered on subsequent
> imports, this code does not deal with "initial checkout" unless
> something else is wrong. The line right above the open() is an else that
> has the block that matters.
>
>> The patch checks the existence of the reference file
>> before assuming an original branch exists. There might be better
>> solutions than checking file existence.
>
> There are indeed. If we need this patch -- then you can call git
> ref-parse right to see if you get a sha1.
>
>> - unless ($last_branch) {
>> + if (-f "$git_dir/$last_branch") {
>
> Note that the file won't exist there in any modern git. It will be in
> $git_dir/refs/heads/$last_branch. Did you test this patch?Martin, it may not even be in $git_dir/refs/heads/$last_branch ;-) The refs can be packed.
By the way, doesn't cvsimport fail when your HEAD is detached with this code?
I always have cvsimport update the pristine upstream branch and rebase my work against it, so I never have the branch cvsimport updates checked out, and for meit seems to work wonderfully (well, at least as wonderful as a workflow that involves any CVS in it could be). I do not see a reason why it should not to work similarly well when my HEAD is detached..