<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>1089</bug_id>
          
          <creation_ts>2011-05-19 09:17:36 +0000</creation_ts>
          <short_desc>bitbake git fetcher leaves working trees in horrible states</short_desc>
          <delta_ts>2011-05-27 18:44:20 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>BitBake</product>
          <component>bitbake</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>Patch sent out. May 27</status_whiteboard>
          <keywords></keywords>
          <priority>High</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>1.1 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Richard Purdie">richard.purdie</reporter>
          <assigned_to name="Ke Yu">ke.yu</assigned_to>
          <cc>bruce.ashfield</cc>
    
    <cc>dvhart</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>13904</commentid>
    <comment_count>0</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2011-05-19 09:17:36 +0000</bug_when>
    <thetext>The git fetcher is providing the correct code but if you do something like:

SRC_URI = &quot;git://git.denx.de/u-boot.git;branch=next;protocol=git;tag=b8339e2b9f32663411dba0f48e25b23f542d53bc&quot;

then change into the workdir, git branch will show &quot;master&quot;. git log shows the head of master. The user then thinks &quot;What?!&quot;

If you run &quot;git status&quot;, you get a scary report which is the differences between master and the specified tag b8339e2b9f32663411dba0f48e25b23f542d53bc.

The reason is the fetcher after doing a clone does:

git read-tree b8339e2b9f32663411dba0f48e25b23f542d53bc
git checkout-index -q -f -a

which means it checkout out the right revision in the index but does not make the branch/heads point at the right places.

We can do better than this...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13915</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2011-05-19 15:21:29 +0000</bug_when>
    <thetext>Adding Bruce as he might have some advice on the better thing to do here...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13933</commentid>
    <comment_count>2</comment_count>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2011-05-20 11:14:06 +0000</bug_when>
    <thetext>Why the use of read-tree in the first place? What is preventing us from using the more lay commands, like checkout?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13943</commentid>
    <comment_count>3</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2011-05-20 18:35:01 +0000</bug_when>
    <thetext>My comments are very similar to Darren&apos;s. I don&apos;t know the
background on why read-tree is being used here at all ?

Since a tag, and not a branch is being specified, what&apos;s 
wrong with auto creating a branch when a tag is specified ?
Or if not auto creating a branch, leave it on master, but
reset to the tag, or some similarly common action that
will keep the index, working tree and staged changes all
in a consistent state ?

I haven&apos;t looked through the code, but it strikes me to
ask why this is even processed differently from a clone
with a specific SRCREV specified ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13944</commentid>
    <comment_count>4</comment_count>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2011-05-20 22:33:07 +0000</bug_when>
    <thetext>I sent an email to the poky list on this, but it seems to me the only reason to do the read-tree/checkout-index approach is for specifying a subdir, but it seems that can be managed more directly and explicitly in the recipe. It seems to me just doing a checkout of the specified hash and leaving the working dir in a detached head state would be the way to go.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13950</commentid>
    <comment_count>5</comment_count>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2011-05-23 11:15:30 +0000</bug_when>
    <thetext>From what I can tell the read-tree usage is all about the subdir concept - checking out only part of the tree. We could do something like:

# just guessing here, commands are inaccurate, pseudo-code only:
if (subdir)
	git read-tree branch:subdir
	git checkout-index
else
	git checkout branch

This would fix the issue for most recipes. Ultimately I think it would make sense to deprecate subdir for git repositories and push the necessary build logic up into the recipe itself.

For now, the fetcher2/git.py is generating the correct source tree, so this isn&apos;t particularly urgent. I&apos;d suggest we drop the Importance a bit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13959</commentid>
    <comment_count>6</comment_count>
    <who name="Ke Yu">ke.yu</who>
    <bug_when>2011-05-24 00:41:28 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; From what I can tell the read-tree usage is all about the subdir concept -
&gt; checking out only part of the tree. We could do something like:
&gt; 
&gt; # just guessing here, commands are inaccurate, pseudo-code only:
&gt; if (subdir)
&gt;     git read-tree branch:subdir
&gt;     git checkout-index
&gt; else
&gt;     git checkout branch
&gt; 
&gt; This would fix the issue for most recipes. Ultimately I think it would make
&gt; sense to deprecate subdir for git repositories and push the necessary build
&gt; logic up into the recipe itself.
&gt; 
&gt; For now, the fetcher2/git.py is generating the correct source tree, so this
&gt; isn&apos;t particularly urgent. I&apos;d suggest we drop the Importance a bit.

yeah, this looks reasonable to me. I can work out this patch.

And currently poky a.k.a oe-core meta data already get rid of the subdir usage, but  there are still bunch of subdir usage in OE, so it is still necessary to keep subdir.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14059</commentid>
    <comment_count>7</comment_count>
    <who name="Ke Yu">ke.yu</who>
    <bug_when>2011-05-27 18:44:20 +0000</bug_when>
    <thetext>http://git.pokylinux.org/cgit/cgit.cgi/poky/commit/?id=a667251041170dbc2f7d6fa72176ca676f68f857</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>