trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: January 2014

Re: [trinity-devel] rebase of 3.5.13 tree drops all non 3.5.13 sources - howto fix?

From: "David C. Rankin" <drankinatty@...>
Date: Fri, 03 Jan 2014 16:59:58 -0600
On 01/03/2014 02:44 AM, David C. Rankin wrote:
> Slavek, all
> 
> After fixing the 3.5.13 source trees I had with:
> 
>   git checkout v3.5.13-sru && git pull --rebase
> 
> I have missing dependencies. (basically all submodules that did not have a
> v3.5.13-sru branch were wiped out) Example:
> 
> On the 3.5.13 tree:
> 
> 02:04 phoinix:/dat_f/tde/tde> l1 main/dependencies/
> arts
> avahi-tqt
> dbus-1-tqt
> dbus-tqt
> qt3
> tqtinterface
> 
> On R14:
> 
> 02:14 phoinix:/dat_e/tde/tde> l1 main/dependencies/
> arts
> avahi-tqt
> dbus-1-tqt
> dbus-tqt
> libart-lgpl
> libcaldav
> libcarddav
> python-tqt
> qt3
> sip4-tqt
> tqca
> tqca-tls
> tqscintilla
> tqt3
> tqtinterface
> 
>   So basically libart-lgpl, libcaldav, libcarddav, python-tqt, sip4-tqt, tqca,
> tqca-tls, and tqscintilla were all dropped from the tree. (I'm sure I'm missing
> others under applications/ as well.
> 
>   How do I pull all the remaining R14 sources/sub-modules into my new 3.5.13
> tree? Do I have to do a manual diff of the directory structures and then do a
> manual "git checkout master -- <missing>" for each missing dir --or-- is there a
> better way to do it? The only other way I can think of would be to do a full git
> checkout master and covert the entire tree to master and then come back and
> switch submodules that have v3.5.13-sru branches back?
> 
>   How do you suggest I fill in the 3.5.13 tree?
> 

I think the problem is this:

16:27 phoinix:/dat_f/tde/tde> git checkout v3.5.13-sru -- scripts
16:27 phoinix:/dat_f/tde/tde/scripts> git branch -l
  experimental
  master
* v3.5.13-sru

16:28 phoinix:/dat_f/tde/tde> git submodule init -- scripts
16:28 phoinix:/dat_f/tde/tde> git submodule update -- scripts
Submodule path 'scripts': checked out '47fb38fad730f4fdfc21e6a89dea1c7a63bb0b71'
16:29 phoinix:/dat_f/tde/tde/scripts> git branch -l
* (detached from 47fb38f)
  master
  v3.5.13-sru

If you ever run submodule update without immediately issuing a "git checkout
<branch>" you will *detach* the submodule: (from man git-submodule)

<quote>

 update
    Update the registered submodules, i.e. clone missing submodules and checkout
the commit specified in the index of the containing repository. This will make
the submodules HEAD be detached unless --rebase or --merge is specified or the
key submodule.$name.update is set to rebase, merge or none.  none can be
overridden by specifying --checkout. Setting the key submodule.$name.update to
!command will cause command to be run.  command can be any arbitrary shell
command that takes a single argument, namely the sha1 to update to.
</quote>

The switch_all_submodules_to_head_and_clean script is the problem. When you issue:

  git submodule update
  git submodule foreach "git checkout $branch && $THISSCRIPT $gituser"

it *ONLY* does 'foreach' for modules within the current branch. If the current
toplevel branch is 'v3.5.13-sru' then all submodules that do NOT have a
'v3.5.13-sru' branch are not included in the foreach loop and are left
*detached*. For example issuing:

  git submodule foreach "git branch -r"

Does not list "main/dependencies/tqscintilla" because there is no v3.5.13-sru
branch. Checking the status of main/dependencies/tqscintilla shows:

16:56 phoinix:/dat_f/tde/tde/main/dependencies/tqscintilla> git branch -l
* (detached from 4285f9d)
  master

So git is very unhappy with the tree. Is there an easier way to fix this other
than looping through all directories and doing an if git branch -r | grep -q
sru; then git checkout v3.5.13-sru && git pull; else git checkout master && git
pull; fi ??

-- 
David C. Rankin, J.D.,P.E.