git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Nicolas Morey-Chaisemartin <devel-git@morey-chaisemartin.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] submodule: Add --force option for git submodule update
Date: Thu, 31 Mar 2011 19:41:32 +0200	[thread overview]
Message-ID: <4D94BCCC.7090808@web.de> (raw)
In-Reply-To: <4D93E4F1.70103@morey-chaisemartin.com>

Am 31.03.2011 04:20, schrieb Nicolas Morey-Chaisemartin:
> On 03/30/2011 11:08 PM, Junio C Hamano wrote:
>> Shouldn't you be questioning _why_ your users have such changes that
>> require them to run "checkout -f" everywhere in the submodule forests and
>> still want to run "submodule update" in the first place?  If it happens
>> very often and your users are constantly discarding what they have half
>> accomplished, there is something wrong with the way your project works.
>
> I did. Thee reason is we commit file generated by compilation.
> Whether it's docs, references (for automated integration) or simply result files that take 2 days to build,
> we have a strong need to commit generated files.

We are in a similar situation at my dayjob, but we handled the issue in
a different way. We were reluctant to check in generated files into our
repository, so we decided to distribute them via zip files. We have a
beefy build machine which builds and tests master over night and if
everything went ok it zips the whole work tree including .git directory,
build artifacts and submodules into one file. Then each developer just
has to unpack this file, fetch from the git server and he is all set.

>> If we read your motivation section in your original,
>>
>>   > This implies that to reset a whole git submodule tree, a user has to run
>>   > first 'git submodule foreach --recursive git checkout -f' to then be
>>   > able to run git submodule update.
>>
>> this is about "resetting", i.e. throwing away the work.  I think that is a
>> sensible thing to do, but it is a very different purpose than "updating
>> submodules so that I can work on top of what other people did", which
>> would happen a lot more often than that.
>>
>> Wouldn't it be both safer and easier to understand for the users if this
>> "obliterate all my uncommitted work" were a separate subcommand, e.g. "git
>> submodule reset --recursive" or something?
> 
> I agree. A git submodule reset command makes a lot of sense.

Me too agrees that being able to reset a whole work tree including all
submodules recursively makes a lot of sense. But I would not be so happy
seeing this functionality being added to the git-submodule.sh script, as
I believe it belongs into "git reset", so you'll just have to do a "git
reset --hard --recurse-submodules" and you are done.

In the branch "git-checkout-recurse-submodules" in my github repo (which
is at https://github.com/jlehmann/git-submod-enhancements) you can see a
preliminary implementation of that (it works and I use it every day at my
job. It has recursion enabled by default at the moment yet still might
overwrite local changes even if it shouldn't, so use with care ;-).

> But I also still think having a --force option to update does too, in the way Jens proposed it (only on submodule that actually needed a checkout), don't you?

Yes, I still think it makes sense to add the "-f" flag to submodule update.

  reply	other threads:[~2011-03-31 17:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-30  7:56 [PATCH] submodule: Add --force option for git submodule update Nicolas Morey-Chaisemartin
2011-03-30 18:32 ` Jens Lehmann
2011-03-30 18:50   ` Nicolas Morey-Chaisemartin
2011-03-30 19:05     ` Jens Lehmann
2011-03-30 20:19       ` Nicolas Morey-Chaisemartin
2011-03-30 21:08         ` Junio C Hamano
2011-03-31  2:20           ` Nicolas Morey-Chaisemartin
2011-03-31 17:41             ` Jens Lehmann [this message]
2011-03-31 18:13               ` Nicolas Morey-Chaisemartin

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=4D94BCCC.7090808@web.de \
    --to=jens.lehmann@web.de \
    --cc=devel-git@morey-chaisemartin.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 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 NNTP newsgroup(s).