git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Heiko Voigt <hvoigt@hvoigt.net>
To: Julian Ibarz <julian.ibarz@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Jens Lehmann <Jens.Lehmann@web.de>,
	git@vger.kernel.org
Subject: Re: Re: Re: Re: Updating a submodule with a compatible version from another submodule version using the parent meta-repository
Date: Sun, 13 Feb 2011 14:30:19 +0100	[thread overview]
Message-ID: <20110213133019.GB31986@book.hvoigt.net> (raw)
In-Reply-To: <AANLkTimist_GXgRGdUW1PpxpRO=poYgD4HkDC5CsyLra@mail.gmail.com>

Hi Julian,

On Sat, Feb 12, 2011 at 03:32:43PM -0500, Julian Ibarz wrote:
> Thanks for all your feedbacks. Before your first mail I had already
> implemented command 1 you are talking about and almost finished
> command 2. Today I could spend some time again on this side project
> and I have finished command 2. Here is what you do:
> 
> git submodulecheckout --find-versions <submodule> > <some_temp_file>
> cd <submodule>
> git submodulecheckout --find-closest < <some_temp_file>

I do not quite understand how this is used. I just tried it on the
msysgit repository. Which is a good candidate for testing since you can
easily verify the results because for each git version there is a
corresponding tag in the superproject.

You can find it on repo: http://repo.or.cz/w/msysgit.git

As far as I understand the sha1 you are searching for is determined by
the currently checked out revision. So here we go:

cd msysgit/git
git checkout v1.7.2.3.msysgit.0~3
cd ..
git submodulecheckout --find-versions git > git-versions.txt
cd git
git submodulecheckout --find-closest < ../git-versions.txt
> submodulecheckout: no commit found

Ok lets not be so hard:

git checkout v1.7.2.3.msysgit.0
cd ..
git submodulecheckout --find-versions git > git-versions.txt
cd git
git submodulecheckout --find-closest < ../git-versions.txt
> 820fd48475eb72cdd4f2

Close but not quite the right commit. See the output of git log:
820fd48 Chomp CRLF before feeding to tar when building netinstaller.
83e164c Avoid quoting environment variable values.
daafc61 (tag: Git-1.7.2.3-preview20100911) Updated git and git documents and ReleaseNotes to v1.7.2.3

Whats strange is that this commit did not even change the submodule.

I think currently it does not make sense to implement the scripting
since the interface is not yet cleaned up enough. It should be possible
to specify a commit as parameter and the path should probably go after
that like the other commands do as well.

The other issue is that we need to change the working directory. IMO,
everything should be possible to do from superproject. Have a look at
add_submodule_odb() in submodule.c it lets you load the database of a
submodule. This way you can run the --find-closest from the superproject.

So what I would be looking for is something like this:

# This looks up all commits of <submodule> ever registered in this
# project
git submodulecheckout --find-versions <submodule> > out.tmp

# This reads the previous list and outputs a list of of all the commits
# that contain <treeish>. Function in_merge_bases(treeish, i&commit, 1)
# can be of help here. Afterwards you have to prune all later commits
# that contain earlier ones. I did this in find_first_merges(). I
# suggest to refactor that code into a function so that you can use it.
git submodulecheckout --find-closest <treeish> -- <submodule> < out.tmp > out2.tmp

# And now we can search for the commit in the other submodule C
git submodulecheckout --list-commits <other submodule> < out2.tmp > out3.tmp

And if out3.tmp just contained one line we could checkout that one. I am
still not sure in which command these options could go. Junio do you
maybe have a suggestion? Since its all about submodules it would make
sense to put it in 'git submodule' but thats already the script.

Maybe a new 'git-submodule-tool' ?

I suggest that you start implementing some basic tests if you found the
right commits using the testsuite. Basically you build up a sample
repository where you know which commits of the submodules are tied
together with a sequence of commands. Then you check whether your
commands find the correct one. Maybe have a look at the submodule
tests Jens is implementing on his branch:

https://github.com/jlehmann/git-submod-enhancements

Hope that helps.

Cheers Heiko

  reply	other threads:[~2011-02-13 13:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTinN1XVsAZXGLqkuhysrJ8-TCtGm4pOu2RfCEVVp@mail.gmail.com>
2011-01-26 18:32 ` Updating a submodule with a compatible version from another submodule version using the parent meta-repository Julian Ibarz
2011-01-26 19:06   ` Jens Lehmann
2011-01-26 19:10     ` Julian Ibarz
2011-01-26 19:39       ` Jens Lehmann
2011-01-26 19:48         ` Julian Ibarz
2011-01-26 20:31           ` Jens Lehmann
2011-01-26 20:43             ` Julian Ibarz
2011-01-26 20:41           ` Junio C Hamano
2011-01-26 20:45             ` Julian Ibarz
2011-01-26 22:05               ` Junio C Hamano
2011-01-29 11:08                 ` Heiko Voigt
2011-01-30  9:44                   ` Julian Ibarz
2011-02-03  4:31                     ` Julian Ibarz
2011-02-06 18:51                       ` Heiko Voigt
2011-02-09 19:36                       ` Heiko Voigt
2011-02-12 20:32                         ` Julian Ibarz
2011-02-13 13:30                           ` Heiko Voigt [this message]
2011-02-13 18:59                             ` Julian Ibarz
2011-02-14 21:13                               ` Heiko Voigt
2011-02-20  1:15                                 ` Julian Ibarz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110213133019.GB31986@book.hvoigt.net \
    --to=hvoigt@hvoigt.net \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=julian.ibarz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).