Merge branch 'dt/notes-multiple'
authorJunio C Hamano <gitster@pobox.com>
Tue, 25 Aug 2015 21:57:08 +0000 (14:57 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 25 Aug 2015 21:57:08 +0000 (14:57 -0700)
When linked worktree is used, simultaneous "notes merge" instances
for the same ref in refs/notes/* are prevented from stomping on
each other.

* dt/notes-multiple:
  notes: handle multiple worktrees
  worktrees: add find_shared_symref

1  2 
branch.c
builtin/notes.c

diff --cc branch.c
+++ b/branch.c
@@@ -302,16 -301,17 +302,17 @@@ void create_branch(const char *head
  
  void remove_branch_state(void)
  {
 -      unlink(git_path("CHERRY_PICK_HEAD"));
 -      unlink(git_path("REVERT_HEAD"));
 -      unlink(git_path("MERGE_HEAD"));
 -      unlink(git_path("MERGE_RR"));
 -      unlink(git_path("MERGE_MSG"));
 -      unlink(git_path("MERGE_MODE"));
 -      unlink(git_path("SQUASH_MSG"));
 +      unlink(git_path_cherry_pick_head());
 +      unlink(git_path_revert_head());
 +      unlink(git_path_merge_head());
 +      unlink(git_path_merge_rr());
 +      unlink(git_path_merge_msg());
 +      unlink(git_path_merge_mode());
 +      unlink(git_path_squash_msg());
  }
  
- static void check_linked_checkout(const char *branch, const char *id)
+ static char *find_linked_symref(const char *symref, const char *branch,
+                               const char *id)
  {
        struct strbuf sb = STRBUF_INIT;
        struct strbuf path = STRBUF_INIT;
diff --cc builtin/notes.c
  #include "string-list.h"
  #include "notes-merge.h"
  #include "notes-utils.h"
+ #include "branch.h"
  
  static const char * const git_notes_usage[] = {
 -      N_("git notes [--ref <notes_ref>] [list [<object>]]"),
 -      N_("git notes [--ref <notes_ref>] add [-f] [-m <msg> | -F <file> | (-c | -C) <object>] [<object>]"),
 -      N_("git notes [--ref <notes_ref>] copy [-f] <from-object> <to-object>"),
 -      N_("git notes [--ref <notes_ref>] append [-m <msg> | -F <file> | (-c | -C) <object>] [<object>]"),
 -      N_("git notes [--ref <notes_ref>] edit [<object>]"),
 -      N_("git notes [--ref <notes_ref>] show [<object>]"),
 -      N_("git notes [--ref <notes_ref>] merge [-v | -q] [-s <strategy> ] <notes_ref>"),
 +      N_("git notes [--ref <notes-ref>] [list [<object>]]"),
 +      N_("git notes [--ref <notes-ref>] add [-f] [--allow-empty] [-m <msg> | -F <file> | (-c | -C) <object>] [<object>]"),
 +      N_("git notes [--ref <notes-ref>] copy [-f] <from-object> <to-object>"),
 +      N_("git notes [--ref <notes-ref>] append [--allow-empty] [-m <msg> | -F <file> | (-c | -C) <object>] [<object>]"),
 +      N_("git notes [--ref <notes-ref>] edit [--allow-empty] [<object>]"),
 +      N_("git notes [--ref <notes-ref>] show [<object>]"),
 +      N_("git notes [--ref <notes-ref>] merge [-v | -q] [-s <strategy>] <notes-ref>"),
        N_("git notes merge --commit [-v | -q]"),
        N_("git notes merge --abort [-v | -q]"),
 -      N_("git notes [--ref <notes_ref>] remove [<object>...]"),
 -      N_("git notes [--ref <notes_ref>] prune [-n | -v]"),
 -      N_("git notes [--ref <notes_ref>] get-ref"),
 +      N_("git notes [--ref <notes-ref>] remove [<object>...]"),
 +      N_("git notes [--ref <notes-ref>] prune [-n | -v]"),
 +      N_("git notes [--ref <notes-ref>] get-ref"),
        NULL
  };