threads / discuss / 46686

Produce contents of index with existing directory as cache

Subject: Produce contents of index with existing directory as cache

## tl;dr

5 messages between Aug 30, 2017 and Aug 31, 2017.

replies: 4people: 2as markdown or json

Florian Weimer· Aug 30, 2017, 14:11 UTC · lore

Is there a variant of “git checkout-index” which will produce the existing index contents, like “git checkout-index” would do with an empty directory, but can reuse an existing directory tree, to avoid writing all files from scratch?

I'm writing some analysis scripts which need to change a checked-out working tree. Right now I'm throwing away the tree after making the changes and create the next tree (which is expected to be quite similar in contents) from scratch, starting with an empty directory. This is quite slow.

Thanks, Florian

David Lloyd· Aug 30, 2017, 14:15 UTC · re: Florian Weimer · lore

Re: Produce contents of index with existing directory as cache

git reset --hard ?
On Wed, Aug 30, 2017 at 9:11 AM, Florian Weimer <fweimer@redhat.com> wrote:
Show 13 quoted lines
> Is there a variant of “git checkout-index” which will produce the
> existing index contents, like “git checkout-index” would do with an
> empty directory, but can reuse an existing directory tree, to avoid
> writing all files from scratch?
>
> I'm writing some analysis scripts which need to change a checked-out
> working tree.  Right now I'm throwing away the tree after making the
> changes and create the next tree (which is expected to be quite similar
> in contents) from scratch, starting with an empty directory.  This is
> quite slow.
>
> Thanks,
> Florian
-- 
- DML
David Lloyd· Aug 30, 2017, 14:55 UTC · re: Florian Weimer · lore

Re: Produce contents of index with existing directory as cache

Ah, does it not?  Perhaps add a "git clean -d -f" as well.
On Wed, Aug 30, 2017 at 9:18 AM, Florian Weimer <fweimer@redhat.com> wrote:
Show 6 quoted lines
> On 08/30/2017 04:15 PM, David Lloyd wrote:
>> git reset --hard ?
>
> That doesn't remove unstaged files.
>
> Florian
-- 
- DML
Florian Weimer· Aug 31, 2017, 09:58 UTC · re: David Lloyd · lore

Re: Produce contents of index with existing directory as cache

On 08/30/2017 04:55 PM, David Lloyd wrote:
Show 5 quoted lines
> On Wed, Aug 30, 2017 at 9:18 AM, Florian Weimer <fweimer@redhat.com> wrote:
>> On 08/30/2017 04:15 PM, David Lloyd wrote:
>>> git reset --hard ?
>>
>> That doesn't remove unstaged files.
> Ah, does it not?  Perhaps add a "git clean -d -f" as well.

It would have to be “git clean -d -f -f -x” (not the two “-f”) to be on the safe side. I wonder what else I'm missing, though, and if this is completely reliable and has the same effect as removing the tree before “git checkout-index”.

Thanks, Florian

← back to recent threads