MCPcopy Index your code
hub / github.com/git/git / create_alias_ce

Function create_alias_ce

read-cache.c:684–702  ·  view source on GitHub ↗

* If we add a filename that aliases in the cache, we will use the * name that we already have - but we don't want to update the same * alias twice, because that implies that there were actually two * different files with aliasing names! * * So we use the CE_ADDED flag to verify that the alias was an old * one before we accept it as */

Source from the content-addressed store, hash-verified

682 * one before we accept it as
683 */
684static struct cache_entry *create_alias_ce(struct index_state *istate,
685 struct cache_entry *ce,
686 struct cache_entry *alias)
687{
688 int len;
689 struct cache_entry *new_entry;
690
691 if (alias->ce_flags & CE_ADDED)
692 die(_("will not add file alias '%s' ('%s' already exists in index)"),
693 ce->name, alias->name);
694
695 /* Ok, create the new entry using the name of the existing alias */
696 len = ce_namelen(alias);
697 new_entry = make_empty_cache_entry(istate, len);
698 memcpy(new_entry->name, alias->name, len);
699 copy_cache_entry(new_entry, ce);
700 save_or_free_index_entry(istate, ce);
701 return new_entry;
702}
703
704void set_object_name_for_intent_to_add_entry(struct cache_entry *ce)
705{

Callers 1

add_to_indexFunction · 0.85

Calls 4

make_empty_cache_entryFunction · 0.85
copy_cache_entryFunction · 0.85
save_or_free_index_entryFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected