All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Ericsson <ae@op5.se>
To: justin <juddhuck@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git-submodule/before-rebase hook
Date: Tue, 18 Nov 2008 08:47:32 +0100	[thread overview]
Message-ID: <49227314.4080709@op5.se> (raw)
In-Reply-To: <CC8B9B47-4985-4B96-B8DB-0B351633C849@justinbalthrop.com>

justin wrote:
> I just discovered git-submodule today, and already I can see it making 
> my life a lot easier. I develop several modules that are used in two 
> different projects, and being able to check in changes from the 
> submodule in either project is something I have been wanting to do for a 
> while. But there is one shortcoming in git-submodule that I haven't 
> figured out how to overcome... yet.
> 
> When I make a change to a submodule and push that change to the parent 
> repository, the change appears to all other users of the repository as a 
> modification to the submodule commit version.

It shouldn't, unless you push the change into a non-bare copy of a checked
out submodule, but that would be rather insane as the submodule rather
than the superproject then gets to decide which version of the submodule
to use.

> A few people at our 
> company use 'git ci -a' to add all of their changes, and I'm afraid they 
> are going to unknowingly revert the submodule back to a previous 
> version.

Ah, now I see where you're coming from. After you issue "git pull" in
the submodule you have to sync the new version of the submodule to the
superproject using "git submodule sync".

> So my plan was to add a post-pull hook that does 'git submodule 
> update --init', so that people who don't do development on the submodule 
> will get updates every time they pull.

Ok, I didn't. Why do you pull into the submodules if you don't want to
sync the code so the superproject gets the benefit of the changes?

> Unfortunately though, there is no 
> such hook in git. I thought post-merge was going to work, but most 
> people at our company use 'git pull --rebase', and post-merge isn't 
> called in that case. The post-checkout hook is called, but the pull 
> hasn't been completed at that point, so updating the submodule doesn't 
> work. Alas, if only there was a post-rebase hook.
> 
> Any ideas other than patching every employee's git source to add a 
> post-rebase hook?
> 

Yes. Only pull in submodules if you intend to sync them afterwards.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

      reply	other threads:[~2008-11-18  7:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-18  3:59 git-submodule/before-rebase hook justin
2008-11-18  7:47 ` Andreas Ericsson [this message]

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

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

  git send-email \
    --in-reply-to=49227314.4080709@op5.se \
    --to=ae@op5.se \
    --cc=git@vger.kernel.org \
    --cc=juddhuck@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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.