MCPcopy Create free account
hub / github.com/git/git / copy_cache_entry_to_ondisk

Function copy_cache_entry_to_ondisk

read-cache.c:2611–2636  ·  view source on GitHub ↗

Copy miscellaneous fields but not the name */

Source from the content-addressed store, hash-verified

2609
2610/* Copy miscellaneous fields but not the name */
2611static void copy_cache_entry_to_ondisk(struct ondisk_cache_entry *ondisk,
2612 struct cache_entry *ce)
2613{
2614 short flags;
2615 const unsigned hashsz = the_hash_algo->rawsz;
2616 uint16_t *flagsp = (uint16_t *)(ondisk->data + hashsz);
2617
2618 ondisk->ctime.sec = htonl(ce->ce_stat_data.sd_ctime.sec);
2619 ondisk->mtime.sec = htonl(ce->ce_stat_data.sd_mtime.sec);
2620 ondisk->ctime.nsec = htonl(ce->ce_stat_data.sd_ctime.nsec);
2621 ondisk->mtime.nsec = htonl(ce->ce_stat_data.sd_mtime.nsec);
2622 ondisk->dev = htonl(ce->ce_stat_data.sd_dev);
2623 ondisk->ino = htonl(ce->ce_stat_data.sd_ino);
2624 ondisk->mode = htonl(ce->ce_mode);
2625 ondisk->uid = htonl(ce->ce_stat_data.sd_uid);
2626 ondisk->gid = htonl(ce->ce_stat_data.sd_gid);
2627 ondisk->size = htonl(ce->ce_stat_data.sd_size);
2628 hashcpy(ondisk->data, ce->oid.hash, the_repository->hash_algo);
2629
2630 flags = ce->ce_flags & ~CE_NAMEMASK;
2631 flags |= (ce_namelen(ce) >= CE_NAMEMASK ? CE_NAMEMASK : ce_namelen(ce));
2632 flagsp[0] = htons(flags);
2633 if (ce->ce_flags & CE_EXTENDED) {
2634 flagsp[1] = htons((ce->ce_flags & CE_EXTENDED_FLAGS) >> 16);
2635 }
2636}
2637
2638static int ce_write_entry(struct hashfile *f, struct cache_entry *ce,
2639 struct strbuf *previous_name, struct ondisk_cache_entry *ondisk)

Callers 1

ce_write_entryFunction · 0.85

Calls 1

hashcpyFunction · 0.85

Tested by

no test coverage detected