* [gentoo-dev] PATCH: git-r3.eclass submodule no-checkout fix
@ 2015-06-26 20:42 Michał Górny
2015-07-09 20:21 ` Michał Górny
0 siblings, 1 reply; 2+ messages in thread
From: Michał Górny @ 2015-06-26 20:42 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1.1: Type: text/plain, Size: 460 bytes --]
Hello,
Here's a quick patch to git-r3.eclass for review. It fixes handling of
repositories where submodules were partially removed -- they're still
listed in .gitmodules but the path was 'git rm'-ed. In this case,
vanilla git ignores the submodule, and the patch causes the eclass to
do that too.
Relevant bug: https://bugs.gentoo.org/show_bug.cgi?id=551100
Patch attached.
--
Best regards,
Michał Górny
<http://dev.gentoo.org/~mgorny/>
[-- Attachment #1.2: git-r3-submodule-r1.patch --]
[-- Type: text/plain, Size: 2035 bytes --]
Index: git-r3.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v
retrieving revision 1.49
diff -u -B -r1.49 git-r3.eclass
--- git-r3.eclass 22 Jun 2015 08:39:36 -0000 1.49
+++ git-r3.eclass 26 Jun 2015 20:39:05 -0000
@@ -710,16 +710,23 @@
local subname=${submodules[0]}
local url=${submodules[1]}
local path=${submodules[2]}
- local commit=$(git rev-parse "${local_ref}:${path}")
- if [[ ! ${commit} ]]; then
- die "Unable to get commit id for submodule ${subname}"
- fi
+ # use only submodules for which path does exist
+ # (this is in par with 'git submodule'), bug #551100
+ # note: git cat-file does not work for submodules
+ if [[ $(git ls-tree -d "${local_ref}" "${path}") ]]
+ then
+ local commit=$(git rev-parse "${local_ref}:${path}" || die)
+
+ if [[ ! ${commit} ]]; then
+ die "Unable to get commit id for submodule ${subname}"
+ fi
- local subrepos
- _git-r3_set_subrepos "${url}" "${repos[@]}"
+ local subrepos
+ _git-r3_set_subrepos "${url}" "${repos[@]}"
- git-r3_fetch "${subrepos[*]}" "${commit}" "${local_id}/${subname}"
+ git-r3_fetch "${subrepos[*]}" "${commit}" "${local_id}/${subname}"
+ fi
submodules=( "${submodules[@]:3}" ) # shift
done
@@ -849,11 +856,16 @@
local subname=${submodules[0]}
local url=${submodules[1]}
local path=${submodules[2]}
- local subrepos
- _git-r3_set_subrepos "${url}" "${repos[@]}"
- git-r3_checkout "${subrepos[*]}" "${out_dir}/${path}" \
- "${local_id}/${subname}"
+ # use only submodules for which path does exist
+ # (this is in par with 'git submodule'), bug #551100
+ if [[ -d ${out_dir}/${path} ]]; then
+ local subrepos
+ _git-r3_set_subrepos "${url}" "${repos[@]}"
+
+ git-r3_checkout "${subrepos[*]}" "${out_dir}/${path}" \
+ "${local_id}/${subname}"
+ fi
submodules=( "${submodules[@]:3}" ) # shift
done
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 949 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [gentoo-dev] PATCH: git-r3.eclass submodule no-checkout fix
2015-06-26 20:42 [gentoo-dev] PATCH: git-r3.eclass submodule no-checkout fix Michał Górny
@ 2015-07-09 20:21 ` Michał Górny
0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2015-07-09 20:21 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 559 bytes --]
Dnia 2015-06-26, o godz. 22:42:07
Michał Górny <mgorny@gentoo.org> napisał(a):
> Hello,
>
> Here's a quick patch to git-r3.eclass for review. It fixes handling of
> repositories where submodules were partially removed -- they're still
> listed in .gitmodules but the path was 'git rm'-ed. In this case,
> vanilla git ignores the submodule, and the patch causes the eclass to
> do that too.
>
> Relevant bug: https://bugs.gentoo.org/show_bug.cgi?id=551100
Committed.
--
Best regards,
Michał Górny
<http://dev.gentoo.org/~mgorny/>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 949 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-09 20:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-26 20:42 [gentoo-dev] PATCH: git-r3.eclass submodule no-checkout fix Michał Górny
2015-07-09 20:21 ` Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox