diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2007-09-24 08:50:58 -0400 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2007-09-24 21:48:39 -0400 |
commit | 85f77eadcc1d6e5a62079ab86988ffe95e9421d5 (patch) | |
tree | a1f90b93957cc635016ac059c434d3cbf7975d5c /lib | |
parent | git-gui: Keep the UI responsive while counting objects in clone (diff) | |
download | tgif-85f77eadcc1d6e5a62079ab86988ffe95e9421d5.tar.xz |
git-gui: Copy objects/info/alternates during standard clone
If the source repository is using an objects/info/alternates file
we need to copy the file to our new repository so that it can access
any objects that won't be copied/hardlinked as they are stored in the
alternate location.
We explicitly resolve all paths in the objects/info/alternates as
relative to the source repository but then convert them into an
absolute path for the new clone. This allows the new clone to
access the exact same locaton as the source repository, even if
relative paths had been used before.
Under Cygwin we assume that Git is Cygwin based and that the paths
in objects/info/alternates must be valid Cygwin UNIX paths, so we
need to run `cygpath --unix` on each line in the alternate list.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/choose_repository.tcl | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl index 4ad1f781f7..f7b8c93095 100644 --- a/lib/choose_repository.tcl +++ b/lib/choose_repository.tcl @@ -470,6 +470,32 @@ method _do_clone2 {} { [mc "buckets"] update + if {[file exists [file join $objdir info alternates]]} { + set pwd [pwd] + if {[catch { + file mkdir [gitdir objects info] + set f_in [open [file join $objdir info alternates] r] + set f_cp [open [gitdir objects info alternates] w] + fconfigure $f_in -translation binary -encoding binary + fconfigure $f_cp -translation binary -encoding binary + cd $objdir + while {[gets $f_in line] >= 0} { + if {[is_Cygwin]} { + puts $f_cp [exec cygpath --unix --absolute $line] + } else { + puts $f_cp [file normalize $line] + } + } + close $f_in + close $f_cp + cd $pwd + } err]} { + catch {cd $pwd} + _clone_failed $this [mc "Unable to copy objects/info/alternates: %s" $err] + return + } + } + set tolink [list] set buckets [glob \ -tails \ |