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

Function split_commit_in_progress

wt-status.c:1333–1366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1331}
1332
1333static int split_commit_in_progress(struct wt_status *s)
1334{
1335 int split_in_progress = 0;
1336 struct object_id head_oid, orig_head_oid;
1337 char *rebase_amend, *rebase_orig_head;
1338 int head_flags, orig_head_flags;
1339
1340 if ((!s->amend && !s->nowarn && !s->workdir_dirty) ||
1341 !s->branch || strcmp(s->branch, "HEAD"))
1342 return 0;
1343
1344 if (refs_read_ref_full(get_main_ref_store(s->repo), "HEAD", RESOLVE_REF_READING | RESOLVE_REF_NO_RECURSE,
1345 &head_oid, &head_flags) ||
1346 refs_read_ref_full(get_main_ref_store(s->repo), "ORIG_HEAD", RESOLVE_REF_READING | RESOLVE_REF_NO_RECURSE,
1347 &orig_head_oid, &orig_head_flags))
1348 return 0;
1349 if (head_flags & REF_ISSYMREF || orig_head_flags & REF_ISSYMREF)
1350 return 0;
1351
1352 rebase_amend = read_line_from_git_path(s->repo, "rebase-merge/amend");
1353 rebase_orig_head = read_line_from_git_path(s->repo, "rebase-merge/orig-head");
1354
1355 if (!rebase_amend || !rebase_orig_head)
1356 ; /* fall through, no split in progress */
1357 else if (!strcmp(rebase_amend, rebase_orig_head))
1358 split_in_progress = !!strcmp(oid_to_hex(&head_oid), rebase_amend);
1359 else if (strcmp(oid_to_hex(&orig_head_oid), rebase_orig_head))
1360 split_in_progress = 1;
1361
1362 free(rebase_amend);
1363 free(rebase_orig_head);
1364
1365 return split_in_progress;
1366}
1367
1368/*
1369 * Turn

Callers 1

show_rebase_in_progressFunction · 0.85

Calls 4

refs_read_ref_fullFunction · 0.85
get_main_ref_storeFunction · 0.85
read_line_from_git_pathFunction · 0.85
oid_to_hexFunction · 0.85

Tested by

no test coverage detected