"git diff" questions

On a checkout for which I haven't touched aux/broccoli, if I issue "git diff"
it tells me:

  diff --git a/aux/broccoli b/aux/broccoli
  index 9866a00..8843da5 160000
  --- a/aux/broccoli
  +++ b/aux/broccoli
  @@ -1 +1 @@
  -Subproject commit 9866a00e78b088315e632960aaa230635bca326a
  +Subproject commit 8843da57dc8aee433550727dcbd1199824ca9da4

(1) Why is it finding a difference? (2) How do I get it to show me
what the difference actually is?

    Vern

This is a, rather annoying, effect of using git submodules. aux/broccoli just points to a particular commit in the broccoli repository. Different topic branches in the main bro repository can point to different commits of submodules. This mostly happens if you are working / looking at a branch that was branched off master a while ago and the submodule pointer in master has then been updated.

> (1) Why is it finding a difference?

For some reason that I don't understand, a git checkout does not check out the appropriate commit of the submodules. It rather leaves the submodules untouched. In order to also do a checkout of the submodules you need to do a

git submodule update --recursive

Thanks for the explanation. Two comments/questions:

git submodule update --recursive

This doesn't work:

  Usage: git submodule [--quiet] [--cached] [add [-b branch] <repo> <path>]|[status|init|update [-i|--init] [-N|--no-fetch]|summary [-n|--summary-limit <n>] [<commit>]] [--] [<path>...]|[foreach <command>]|[sync [--] [<path>...]]

(I'm running git 1.6.3.2.)

Assuming that you were in "master" and did a check-out of "topic/foobar"

All I did was check-out "master", I'm pretty sure. (Is there a command
that will tell me how I wound up with the tree I have?)

    Vern

(I'm running git 1.6.3.2.)

Hmmm, so that was old crude due to my laptop upgrade. I'm now installing
git 1.7 and will try that.

    Vern

Thanks for the explanation. Two comments/questions:

git submodule update --recursive

This doesn't work:

  Usage: git submodule [--quiet] [--cached] [add [-b branch]<repo> <path>]|[status|init|update [-i|--init] [-N|--no-fetch]|summary [-n|--summary-limit<n>] [<commit>]] [--] [<path>...]|[foreach<command>]|[sync [--] [<path>...]]

(I'm running git 1.6.3.2.)

Hmm. I'm running 1.7.5.4. I guess that added the recursive then....

You can probably use:
   git submodule update
   git submodule foreach git submodule update

(IIRC the broccoli repository has submodules of its own, so you need to either to it recursively or do it "by hand" using the submodule foreach)

Assuming that you were in "master" and did a check-out of "topic/foobar"

All I did was check-out "master", I'm pretty sure. (Is there a command
that will tell me how I wound up with the tree I have?)

>

Unfortunately not. Since in theory it should not matter how you wound up with the tree. The submodules just bust this nice theory :frowning:

What could also have happend is that you cloned (and checked out) master a while ago and then later updated it with a git pull/fetch. If the submodule pointers in master changed in the meantime you would also get this notice.

cu
gregor

That's my guess actually. I've defined me a macro to get the
submodules right, see "git fix-submodules" here:

    http://www.bro-ids.org/development/process.html#useful-git-macros

Robin