| 1470 | } |
| 1471 | |
| 1472 | static const char *update_worktree(unsigned char *sha1, const struct worktree *worktree) |
| 1473 | { |
| 1474 | const char *retval; |
| 1475 | char *git_dir; |
| 1476 | struct strvec env = STRVEC_INIT; |
| 1477 | int invoked_hook; |
| 1478 | |
| 1479 | if (!worktree || !worktree->path) |
| 1480 | BUG("worktree->path must be non-NULL"); |
| 1481 | |
| 1482 | if (worktree->is_bare) |
| 1483 | return "denyCurrentBranch = updateInstead needs a worktree"; |
| 1484 | git_dir = get_worktree_git_dir(worktree); |
| 1485 | |
| 1486 | strvec_pushf(&env, "GIT_DIR=%s", absolute_path(git_dir)); |
| 1487 | |
| 1488 | retval = push_to_checkout(sha1, &invoked_hook, &env, worktree->path); |
| 1489 | if (!invoked_hook) |
| 1490 | retval = push_to_deploy(sha1, &env, worktree); |
| 1491 | |
| 1492 | strvec_clear(&env); |
| 1493 | free(git_dir); |
| 1494 | return retval; |
| 1495 | } |
| 1496 | |
| 1497 | static const char *update(struct command *cmd, struct shallow_info *si) |
| 1498 | { |
no test coverage detected