All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kyle Moffett <kyle@moffetthome.net>
To: Hilco Wijbenga <hilco.wijbenga@gmail.com>
Cc: Michael Witten <mfwitten@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Evan Shelhamer <shelhamer@imaginarynumber.net>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: Branches & directories
Date: Mon, 22 Aug 2011 08:46:48 -0400	[thread overview]
Message-ID: <CAGZ=bqLZoLoyMcvnppg6SyFtJU8phSquQeBZ7uhwP=+ZL3DADw@mail.gmail.com> (raw)
In-Reply-To: <CAE1pOi1J5DKtnyUQzu1K7G1+HLsWWCN7thCf6W8MwSzt4_vtOw@mail.gmail.com>

On Mon, Aug 22, 2011 at 01:36, Hilco Wijbenga <hilco.wijbenga@gmail.com> wrote:
> On 21 August 2011 20:01, Kyle Moffett <kyle@moffetthome.net> wrote:
>> On Sun, Aug 21, 2011 at 22:13, Hilco Wijbenga <hilco.wijbenga@gmail.com> wrote:
>>> Thanks for sticking it out. :-) That all makes sense. I think it's all
>>> pretty clear now.
>>
>> It's worth mentioning that in most cases you DON'T want to delete untracked and
>> ignored files when switching branches.
>
> For the record, I don't want them deleted but replaced with the
> artifacts in the other branch. A bit wasteful but it saves a lot of
> build time.
>
>> For example, when I'm doing kernel development, I will frequently do this:
>>
>> $ git checkout -b my-new-feature origin/master
>> [...hack hack hack...]
>> $ make -j16 && make install && reboot
>> [...find unrelated bug...]
>> $ git checkout -b my-new-bugfix origin/master
>> [...fix the bug...]
>> $ make -j16 && make install && reboot
>> $ git commit -m 'I fixed this bug'
>> $ git checkout my-new-feature
>> $ git rebase my-new-bugfix
>> $ make -j16 && make install && reboot
>>
>> To avoid wasting time I don't want to completely rebuild the kernel each
>> and every time I switch branches, I just want to rebuild the files that
>> changed when I switched.  The way GIT works lets me do that quite
>> easily, and the kernel Makefiles detect the changed files and rebuild
>> the minimum amount necessary.
>>
>> GIT's behavior when you switch between branches is effectively the
>> same as applying a patch generated by diffing between the two
>> branches.  Any files which would not be changed are left alone, their
>> timestamps completely unchanged.
>
> For small changes that makes perfect sense. I'm at a stage where APIs
> are still evolving and changing an API means rebuilding lots of code.
> I'd like to avoid that.
>
>> It sounds like Eclipse is simply not detecting changes to your working
>> tree by outside programs, and as a result it's not rebuilding files and
>> indexes the way that it should.
>
> While Eclipse isn't great at detecting such changes, this isn't really
> an Eclipse problem. It's just that lots of things are still changing
> and that leads to lots of building.
>
>> Obviously the easiest way to work around that issue is "git clean",
>> which has options to select all untracked files or just ignored ones.
>
> As I mentioned above, I don't want to *delete* untracked/ignored
> files, I just want them to stick to the branch I was working on. So if
> I change to a different branch I get the appropriate build artifacts.
>
> Something like: git stash --everything "All artifacts for
> this-branch." && git checkout other-branch && git stash apply
> stash-for-other-branch.

When I am in those sorts of situations I generally just use separate
working directories or separate checkouts entirely; if you really prefer
to have everything in one directory you would be better served by
integrating "ccache" into your workflow.

In particular, even "git stash" intentionally does not preserve file times,
so you would end up rebuilding everything anyways because all of your
source files would be as new as your object files.

If you use "ccache" then it does not matter what branches you are
on; identical source files and compiler options will be looked up in the
cache and the result (if found) copied to the output file.

Cheers,
Kyle Moffett

  reply	other threads:[~2011-08-22 12:47 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-17 18:35 Branches & directories Hilco Wijbenga
2011-08-17 18:47 ` Evan Shelhamer
2011-08-17 19:14   ` Junio C Hamano
2011-08-17 21:23     ` Hilco Wijbenga
2011-08-18  4:45       ` Jonathan Nieder
2011-08-21 19:48         ` Hilco Wijbenga
2011-08-18  5:52       ` Michael Witten
2011-08-18 10:56         ` Michael J Gruber
2011-08-18 17:49           ` Michael Witten
2011-08-19  0:13         ` Jonathan Nieder
2011-08-21 20:25         ` Hilco Wijbenga
2011-08-21 20:53           ` Michael Witten
2011-08-21 21:37             ` Hilco Wijbenga
2011-08-21 23:06               ` Michael Witten
2011-08-21 23:35                 ` Hilco Wijbenga
2011-08-22  0:07                   ` Michael Witten
2011-08-22  0:47                     ` Hilco Wijbenga
2011-08-22  1:53                       ` Hilco Wijbenga
2011-08-22  2:05                       ` Michael Witten
2011-08-22  2:13                         ` Hilco Wijbenga
2011-08-22  3:01                           ` Kyle Moffett
2011-08-22  5:36                             ` Hilco Wijbenga
2011-08-22 12:46                               ` Kyle Moffett [this message]
2011-08-22 18:49                                 ` Hilco Wijbenga
2011-08-22 19:31                                   ` Kyle Moffett
2011-08-22 20:10                                     ` Hilco Wijbenga
2011-08-22 21:01                                       ` Restoring timestamps (Re: Branches & directories) Jonathan Nieder
2011-08-22 22:33                                         ` Hilco Wijbenga
2011-08-22 23:21                                           ` Jonathan Nieder
2011-08-23  3:06                                             ` Hilco Wijbenga
2011-08-23  3:20                                               ` Hilco Wijbenga
2011-10-02 15:06                                               ` Enrico Weigelt
2011-10-02 22:29                                                 ` Hilco Wijbenga
     [not found]                                               ` <CA+sFfMf=gi5CWyfZEt-Nmdr4J9g__maQTqy1WePr1x8D-AVr4A@mail.gmail.com>
2011-10-02 22:25                                                 ` Hilco Wijbenga
2011-08-23 14:46                                       ` Branches & directories Michael Witten
2011-10-02 16:57                                       ` Robin Rosenberg
2011-10-02 17:31                                         ` Ronan Keryell
2011-10-02 19:09                                           ` Matthieu Moy
2011-10-02 23:45                                             ` Hilco Wijbenga
2011-10-02 23:40                                         ` Hilco Wijbenga
2011-10-03  3:07                                           ` Jeff King
2011-10-03  7:15                                             ` Hilco Wijbenga
2011-10-03  7:30                                               ` Jeff King
2011-10-03  7:32                                               ` Matthieu Moy
2011-10-03  7:34                                                 ` Jeff King
2011-10-03  7:41                                                   ` Matthieu Moy
2011-10-03  7:44                                                     ` Jeff King
2011-10-03  7:48                                                       ` Junio C Hamano
2011-10-03  7:51                                                         ` Jeff King
2011-10-03 17:31                                                 ` Hilco Wijbenga
2011-10-03 14:59                                               ` Robin Rosenberg
2011-10-03 17:20                                                 ` Hilco Wijbenga

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='CAGZ=bqLZoLoyMcvnppg6SyFtJU8phSquQeBZ7uhwP=+ZL3DADw@mail.gmail.com' \
    --to=kyle@moffetthome.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hilco.wijbenga@gmail.com \
    --cc=mfwitten@gmail.com \
    --cc=shelhamer@imaginarynumber.net \
    /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.