static void setup_default_push_refspecs(struct remote *remote) { int triangular = is_workflow_triangular(remote); switch (push_default) { default: case PUSH_DEFAULT_UNSPECIFIED: default_matching_used = 1; warn_unspecified_push_default_configuration(); /* fallthru */ case PUSH_DEFAULT_MATCHING: add_refspec(":"); break; case PUSH_DEFAULT_SIMPLE: setup_push_simple(remote, get_current_branch(remote), triangular); break; case PUSH_DEFAULT_UPSTREAM: setup_push_upstream(remote, get_current_branch(remote), triangular); break; case PUSH_DEFAULT_CURRENT: setup_push_current(remote, get_current_branch(remote)); break; case PUSH_DEFAULT_NOTHING: die(_("You didn't specify any refspecs to push, and " "push.default is \"nothing\".")); break; } }
void command_commit() { char branch_name[1024]; char branch_head_filename[1024]; get_current_branch(branch_name); sprintf(branch_head_filename, ".mit/%s", branch_name); FILE* index_file = fopen(".mit/index", "r"); if(!index_file) { printf("No indexfile found\n"); return; } FILE* head_file = fopen(branch_head_filename, "w"); if(!head_file) { printf("Could not open headfile\n"); return; } char c; /* Character read from file */ c = fgetc(index_file); while(!feof(index_file)) { fputc(c, head_file); c = fgetc(index_file); } fclose(index_file); fclose(head_file); unlink(".mit/index"); }
void UI_get_branch_map(emulator_instance& inst, uint64_t& cur, std::map<uint64_t, std::string>& namemap, std::map<uint64_t, std::set<uint64_t>>& childmap) { auto project = inst.project; inst.iqueue->run([project, &cur, &namemap, &childmap]() { auto p = project->get(); if(!p) return; fill_namemap(*p, 0, namemap, childmap); cur = p->get_current_branch(); }); }
void project_state::recursive_list_branch(uint64_t bid, std::set<unsigned>& dset, unsigned depth, bool last_of) { auto prj = get(); if(!prj) { messages << "Not in project context." << std::endl; return; } std::set<uint64_t> children = prj->branch_children(bid); std::string prefix; for(unsigned i = 0; i + 1 < depth; i++) prefix += (dset.count(i) ? "\u2502" : " "); prefix += (dset.count(depth - 1) ? (last_of ? "\u2514" : "\u251c") : " "); if(last_of) dset.erase(depth - 1); messages << prefix << ((bid == prj->get_current_branch()) ? "*" : "") << bid << ":" << prj->get_branch_name(bid) << std::endl; dset.insert(depth); size_t c = 0; for(auto i : children) { bool last = (++c == children.size()); recursive_list_branch(i, dset, depth + 1, last); } dset.erase(depth); }
void command_status() { char current_branch[255]; get_current_branch(current_branch); printf("# On branch %s\n", current_branch); print_index_contents(); }