GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — clibrowser/cligit/src/commands/commit.rs at main · allthingssecurity/clibrowser Expand file tree/ Copy pathcommit.rsMore file actions 39 lines (33 loc) · 1.12 KB / Copy pathcommit.rsFile metadata and controls39 lines (33 loc) · 1.12 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 use anyhow::Result; use crate::cli::CommitArgs; use crate::git_ctx::GitContext; use crate::models::*; use crate::output::OutputConfig; pub fn execute(args: CommitArgs, ctx: &GitContext, out: &OutputConfig) -> Result<i32> { let repo = &ctx.repo; let mut index = repo.index()?; if args.all { // Stage all modified tracked files index.update_all(["*"].iter(), None)?; index.write()?; } let tree_oid = index.write_tree()?; let tree = repo.find_tree(tree_oid)?; let sig = repo.signature()?; let parents = match repo.head() { Ok(head) => { let commit = head.peel_to_commit()?; vec![commit] } Err(_) => vec![], // Initial commit }; let parent_refs: Vec<&git2::Commit> = parents.iter().collect(); let oid = repo.commit(Some("HEAD"), &sig, &sig, &args.message, &tree, &parent_refs)?; let sha = oid.to_string(); let result = WriteResult { message: format!("Created commit {}", &sha[..7.min(sha.len())]), }; if out.json { out.print_json(&result); } else { out.print_human(&result.message); } Ok(0) } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |