From: Junio C Hamano Date: Tue, 20 Dec 2011 00:05:45 +0000 (-0800) Subject: Merge branch 'jn/maint-sequencer-fixes' X-Git-Tag: v1.7.9-rc0~48 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b8fc5abd73e2e81c396844c09e8003de320709e5?ds=inline;hp=-c Merge branch 'jn/maint-sequencer-fixes' * jn/maint-sequencer-fixes: revert: stop creating and removing sequencer-old directory Revert "reset: Make reset remove the sequencer state" revert: do not remove state until sequence is finished revert: allow single-pick in the middle of cherry-pick sequence revert: pass around rev-list args in already-parsed form revert: allow cherry-pick --continue to commit before resuming revert: give --continue handling its own function --- b8fc5abd73e2e81c396844c09e8003de320709e5 diff --combined branch.c index a715a11749,a6b6722e24..c2e625f40c --- a/branch.c +++ b/branch.c @@@ -3,7 -3,6 +3,6 @@@ #include "refs.h" #include "remote.h" #include "commit.h" - #include "sequencer.h" struct tracking { struct refspec spec; @@@ -136,37 -135,6 +135,37 @@@ static int setup_tracking(const char *n return 0; } +struct branch_desc_cb { + const char *config_name; + const char *value; +}; + +static int read_branch_desc_cb(const char *var, const char *value, void *cb) +{ + struct branch_desc_cb *desc = cb; + if (strcmp(desc->config_name, var)) + return 0; + free((char *)desc->value); + return git_config_string(&desc->value, var, value); +} + +int read_branch_desc(struct strbuf *buf, const char *branch_name) +{ + struct branch_desc_cb cb; + struct strbuf name = STRBUF_INIT; + strbuf_addf(&name, "branch.%s.description", branch_name); + cb.config_name = name.buf; + cb.value = NULL; + if (git_config(read_branch_desc_cb, &cb) < 0) { + strbuf_release(&name); + return -1; + } + if (cb.value) + strbuf_addstr(buf, cb.value); + strbuf_release(&name); + return 0; +} + int validate_new_branchname(const char *name, struct strbuf *ref, int force, int attr_only) { @@@ -191,8 -159,7 +190,8 @@@ void create_branch(const char *head, const char *name, const char *start_name, - int force, int reflog, enum branch_track track) + int force, int reflog, int clobber_head, + enum branch_track track) { struct ref_lock *lock = NULL; struct commit *commit; @@@ -207,8 -174,7 +206,8 @@@ explicit_tracking = 1; if (validate_new_branchname(name, &ref, force, - track == BRANCH_TRACK_OVERRIDE)) { + track == BRANCH_TRACK_OVERRIDE || + clobber_head)) { if (!force) dont_change_ref = 1; else @@@ -280,5 -246,4 +279,4 @@@ void remove_branch_state(void unlink(git_path("MERGE_MSG")); unlink(git_path("MERGE_MODE")); unlink(git_path("SQUASH_MSG")); - remove_sequencer_state(0); }