1

In a build system based on rake, someone has linked in specific commits. In the code directory on github this shows up as a directory leading to nowhere, but interestingly, github seems to understand the commit ID, as it is shown after the filename with @ [commit-id], see the screenshot below.

How can I modify this? When I clone the repository locally, git just creates empty directories, no meta information to be found. I think I'm missing the right keyword on what that this called. It seems like a URL that can be added as a link to a git project, that github understands.

In the rake task code in question, these files are called 'plugins', but that doesn't lead me to any useful information either. Rake is able to read the commit ID somehow through an environment variable 'plugins'. I can't figure out how this variable is being set, as the setter doesn't seem to appear anywhere in the repository. Do I need some sort of magic from a rake binary to do what I need?

Any help from someone with more github and/or rake experience would be greatly appreciated.

github display of commit id

Michel Müller
  • 5,535
  • 3
  • 31
  • 49

2 Answers2

1

this shows up as a directory leading to nowhere

It should be a git submodule, if you see a corresponding entry in a .gitmodules.
In which case, a git clone --recurse-submodules should be enough.

If not, it is a gitlink (special entry in the index), which only recorded a SHA1, without recording the URL of the distant repo.

The OP Michel Müller confirms it is a submodule, just not referencing the refspec he wants (that is 1.7.0).
All he needs to do (and describes in his answer) is to go into that submodule, checkout the right tag, go back in the parent folder, add, commit and push.
That would record a new gitlink with the right SHA1.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you. Seems to be a submodule represented with a 160000 mode entry as well as an entry in .gitmodules. I tried to change it by doing `git rm --cached dependencies/couchdb` and then doing `git submodule add https://github.com/apache/couchdb dependencies/couchdb`, but that didn't seem to work, now I have a strange state in my local repo. doing `git submodule init ; git submodule update` only checks out another dependency, not couchdb, so the dir remains empty. `git ls-tree HEAD dependencies/couchdb` still shows the entry with the old commit. How can I proceed from here? – Michel Müller Nov 09 '17 at 06:43
  • @MichelMüller "Seems to be a submodule represented with a 160000 mode entry as well as an entry in .gitmodules" If it was, a simple `git submodule update --init` would have been enough to clone the submodule repo in its subfolder. Try and clone again the repo to see if that is working. Note: with a `git clone --recurse-submodules`, it should already be checked out (and not empty) – VonC Nov 09 '17 at 07:13
1

Alright, with the help of @VonC I was able to figure this out - thank you! Let me provide a full answer for my question though:

  1. This simply were git submodules. The commit that github displays, comes from the git index, i.e. cannot be seen directly in the file system.

  2. To change it:

    a. git clone --recurse-submodules https://github.com/muellermichel/build-couchdb.git

    b. cd build-couchdb/dependencies/couchdb

    c. git checkout 1.7.0 <-- the tagged version I want to use

    d. cd .. <-- very important

    e. git add couchdb <-- note: doesn't add the whole couchdb source tree, only the modification of the linked commit.

    f. git commit && push

    g. git ls-tree HEAD dependencies/couchdb/ --> 160000 commit 5f88da2a5ee8ba78917fafd572c7b9fa37e76460 dependencies/couchdb, shows the new commit.

After pushing, github changes the displayed commit immediately:

new commit

Michel Müller
  • 5,535
  • 3
  • 31
  • 49