Skip to content

Commit e6e8a78

Browse files
committed
fix: ensure each ref maps to a single commit
Signed-off-by: MYUU <[email protected]>
1 parent d39d0c8 commit e6e8a78

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

ceres/src/api_service/mono_api_service.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1183,13 +1183,25 @@ impl MonoApiService {
11831183
);
11841184
let commit_id = commit.id.to_string();
11851185
new_commit_id = commit_id.clone();
1186+
1187+
// Construct a commit record without a parent commit
1188+
// For details, refer to the `head_hash` method invoked when cloning a repository.
1189+
let c: Commit = Commit::new(
1190+
commit.author.clone(),
1191+
commit.committer.clone(),
1192+
update.tree_id,
1193+
vec![],
1194+
&commit.message,
1195+
);
1196+
11861197
commits.push(commit);
1198+
commits.push(c.clone());
11871199

11881200
let mut push_update = |ref_name: &str| {
11891201
updates.push(RefUpdateData {
11901202
path: p_ref.path.clone(),
11911203
ref_name: ref_name.to_string(),
1192-
commit_id: commit_id.clone(),
1204+
commit_id: c.id.to_string().clone(),
11931205
tree_hash: update.tree_id.to_string(),
11941206
});
11951207
};

0 commit comments

Comments
 (0)