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
index 3364adf1821b9a8b9bb0d81e8f1987f611eecdbc,483c52740f75b1b47a80df67f167d039c7ef9d1b..d013374e5a0b5714836be77709b07a5e3f67ed2a
+++ 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
index 63f95fc55439060670879fd987033000b8ba3401,b97bcb07ef05ac8efec77e57c17d552f85b9ac68..04234808270908ecc5a8b6e015749ceaa29bb081
  #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
  };