سؤال

The impetus behind this is to manage both the source and wiki repositories of GitHub and be able to git tag the state of the entire project for releases. If there is an easier way to go about this, I'm all ears in the comments :)


I need to be able to include some sort of identifier for the state of a submodule (as returned be git submodule status, for example) in the tag. I don't really need to be able to package it all up (as in Include a GitHub submodule automatically in download)—I only need the ability to include this identifier—but any additional functionality available to me is awesome.

As an aside, I'm surprised this isn't kept track of in .gitmodules. I understand it's somewhere in .git, but it doesn't seem to be the case that any information therein is tracked (it makes sense for it not to be).

هل كانت مفيدة؟

المحلول

The commit id associated with the submodule is stored as a commit object in the tree object for the directory containing the submodule. For example, I have packstack checked out locally which has a number of submodules in packstack/puppet/modules; we can see the commits like this:

$ git ls-tree HEAD | awk '/packstack/ {print $3}'
e7f8ff02ee9ceb26df165439fdffdad13e7ffe63
$ git ls-tree e7f8ff02ee9ceb26df165439fdffdad13e7ffe63 | awk '/puppet/ {print $3}'
0f710acfee985c3f8c3e559425a76194a4a809ea
$ git ls-tree 0f710acfee985c3f8c3e559425a76194a4a809ea | awk '/modules/ {print $3}'
1ccbe1d23c3ae2f2fe6aab987dd8d84d634012ef
$ git ls-tree 1ccbe1d23c3ae2f2fe6aab987dd8d84d634012ef
160000 commit 6d2dc044e12c4c687647cff8bc60c981d9ed5312  heat
160000 commit 17ba6a73cec7f386922e6a914a120a829e225efc  horizon
160000 commit fe9b0d5229ea37179a08c4b49239da9bc950acd1  inifile
160000 commit bb67ef3e0a7c605cee97f9a8ccd13000290f9b39  keystone
.
.
.

And of course you can see the commit ids for previous versions of your repository by starting somewhere other than HEAD.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top