8 BRANCH_TRACK_UNSPECIFIED
= -1,
9 BRANCH_TRACK_NEVER
= 0,
12 BRANCH_TRACK_EXPLICIT
,
13 BRANCH_TRACK_OVERRIDE
,
17 extern enum branch_track git_branch_track
;
19 /* Functions for acting on the information about branches. */
22 * Creates a new branch, where:
24 * - r is the repository to add a branch to
26 * - name is the new branch name
28 * - start_name is the name of the existing branch that the new branch should
31 * - force enables overwriting an existing (non-head) branch
33 * - clobber_head_ok allows the currently checked out (hence existing)
34 * branch to be overwritten; without 'force', it has no effect.
36 * - reflog creates a reflog for the branch
38 * - quiet suppresses tracking information
40 * - track causes the new branch to be configured to merge the remote branch
41 * that start_name is a tracking branch for (if any).
44 void create_branch(struct repository
*r
,
45 const char *name
, const char *start_name
,
46 int force
, int clobber_head_ok
,
47 int reflog
, int quiet
, enum branch_track track
);
50 * Check if 'name' can be a valid name for a branch; die otherwise.
51 * Return 1 if the named branch already exists; return 0 otherwise.
52 * Fill ref with the full refname for the branch.
54 int validate_branchname(const char *name
, struct strbuf
*ref
);
57 * Check if a branch 'name' can be created as a new branch; die otherwise.
58 * 'force' can be used when it is OK for the named branch already exists.
59 * Return 1 if the named branch already exists; return 0 otherwise.
60 * Fill ref with the full refname for the branch.
62 int validate_new_branchname(const char *name
, struct strbuf
*ref
, int force
);
65 * Remove information about the merge state on the current
66 * branch. (E.g., MERGE_HEAD)
68 void remove_merge_branch_state(struct repository
*r
);
71 * Remove information about the state of working on the current
72 * branch. (E.g., MERGE_HEAD)
74 void remove_branch_state(struct repository
*r
, int verbose
);
77 * Configure local branch "local" as downstream to branch "remote"
78 * from remote "origin". Used by git branch --set-upstream.
79 * Returns 0 on success.
81 #define BRANCH_CONFIG_VERBOSE 01
82 int install_branch_config(int flag
, const char *local
, const char *origin
, const char *remote
);
85 * Read branch description
87 int read_branch_desc(struct strbuf
*, const char *branch_name
);
90 * Check if a branch is checked out in the main worktree or any linked
91 * worktree and die (with a message describing its checkout location) if
94 void die_if_checked_out(const char *branch
, int ignore_current_worktree
);
97 * Update all per-worktree HEADs pointing at the old ref to point the new ref.
98 * This will be used when renaming a branch. Returns 0 if successful, non-zero
101 int replace_each_worktree_head_symref(const char *oldref
, const char *newref
,