Thread (1 message) 1 message, 1 author, 2018-10-07

Re: [PATCH v2 3/8] refs: new ref types to make per-worktree refs visible to all worktrees

From: Junio C Hamano <hidden>
Date: 2018-10-07 01:37:39

Nguyễn Thái Ngọc Duy  [off-list ref] writes:
quoted hunk
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 2dd77f9485..9ca2a3706c 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
...
 	case REF_TYPE_PSEUDOREF:
 		strbuf_addf(sb, "%s/logs/%s", refs->gitdir, refname);
 		break;
+	case REF_TYPE_OTHER_PSEUDOREF:
+		return files_reflog_path_other_worktrees(refs, sb, refname);
+	case REF_TYPE_MAIN_PSEUDOREF:
+		if (!skip_prefix(refname, "main-worktree/", &refname))
+			BUG("ref %s is not a main pseudoref", refname);
+		/* passthru */
Correct spelling of the colloquial phrase is fallthru, but see
1cf01a34 ("consistently use "fallthrough" comments in switches",
2017-09-21) that encourages use of "fallthrough" fully spelled out.

Otherwise you'd see something like this.

    CC refs/files-backend.o
refs/files-backend.c: In function 'files_ref_path':
refs/files-backend.c:203:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
   if (!skip_prefix(refname, "main-worktree/", &refname))
      ^
refs/files-backend.c:206:2: note: here
  case REF_TYPE_OTHER_PSEUDOREF:
  ^~~~
refs/files-backend.c: In function 'files_reflog_path':
refs/files-backend.c:181:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
   if (!skip_prefix(refname, "main-worktree/", &refname))
      ^
refs/files-backend.c:184:2: note: here
  case REF_TYPE_NORMAL:
  ^~~~
cc1: all warnings being treated as errors
Makefile:2289: recipe for target 'refs/files-backend.o' failed
make: *** [refs/files-backend.o] Error 1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help