/[gentoo-x86]/eclass/git-r3.eclass
Gentoo

Diff of /eclass/git-r3.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.49 Revision 1.50
1# Copyright 1999-2015 Gentoo Foundation 1# Copyright 1999-2015 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.49 2015/06/22 08:39:36 mrueg Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.50 2015/07/09 20:21:05 mgorny Exp $
4 4
5# @ECLASS: git-r3.eclass 5# @ECLASS: git-r3.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Michał Górny <mgorny@gentoo.org> 7# Michał Górny <mgorny@gentoo.org>
8# @BLURB: Eclass for fetching and unpacking git repositories. 8# @BLURB: Eclass for fetching and unpacking git repositories.
708 708
709 while [[ ${submodules[@]} ]]; do 709 while [[ ${submodules[@]} ]]; do
710 local subname=${submodules[0]} 710 local subname=${submodules[0]}
711 local url=${submodules[1]} 711 local url=${submodules[1]}
712 local path=${submodules[2]} 712 local path=${submodules[2]}
713
714 # use only submodules for which path does exist
715 # (this is in par with 'git submodule'), bug #551100
716 # note: git cat-file does not work for submodules
717 if [[ $(git ls-tree -d "${local_ref}" "${path}") ]]
718 then
713 local commit=$(git rev-parse "${local_ref}:${path}") 719 local commit=$(git rev-parse "${local_ref}:${path}" || die)
714 720
715 if [[ ! ${commit} ]]; then 721 if [[ ! ${commit} ]]; then
716 die "Unable to get commit id for submodule ${subname}" 722 die "Unable to get commit id for submodule ${subname}"
717 fi 723 fi
718 724
719 local subrepos 725 local subrepos
720 _git-r3_set_subrepos "${url}" "${repos[@]}" 726 _git-r3_set_subrepos "${url}" "${repos[@]}"
721 727
722 git-r3_fetch "${subrepos[*]}" "${commit}" "${local_id}/${subname}" 728 git-r3_fetch "${subrepos[*]}" "${commit}" "${local_id}/${subname}"
729 fi
723 730
724 submodules=( "${submodules[@]:3}" ) # shift 731 submodules=( "${submodules[@]:3}" ) # shift
725 done 732 done
726 fi 733 fi
727} 734}
847 854
848 while [[ ${submodules[@]} ]]; do 855 while [[ ${submodules[@]} ]]; do
849 local subname=${submodules[0]} 856 local subname=${submodules[0]}
850 local url=${submodules[1]} 857 local url=${submodules[1]}
851 local path=${submodules[2]} 858 local path=${submodules[2]}
859
860 # use only submodules for which path does exist
861 # (this is in par with 'git submodule'), bug #551100
862 if [[ -d ${out_dir}/${path} ]]; then
852 local subrepos 863 local subrepos
853 _git-r3_set_subrepos "${url}" "${repos[@]}" 864 _git-r3_set_subrepos "${url}" "${repos[@]}"
854 865
855 git-r3_checkout "${subrepos[*]}" "${out_dir}/${path}" \ 866 git-r3_checkout "${subrepos[*]}" "${out_dir}/${path}" \
856 "${local_id}/${subname}" 867 "${local_id}/${subname}"
868 fi
857 869
858 submodules=( "${submodules[@]:3}" ) # shift 870 submodules=( "${submodules[@]:3}" ) # shift
859 done 871 done
860 fi 872 fi
861 873

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.50

  ViewVC Help
Powered by ViewVC 1.1.20