lib/braid/operations.rb in braid-1.0.14 vs lib/braid/operations.rb in braid-1.0.15
- old
+ new
@@ -159,9 +159,21 @@
Braid.verbose
end
end
class Git < Proxy
+ # Get the physical path to a file in the git repository (e.g.,
+ # 'MERGE_MSG'), taking into account worktree configuration. The returned
+ # path may be absolute or relative to the current working directory.
+ def repo_file_path(path)
+ if require_version('2.5') # support for --git-path
+ invoke(:rev_parse, '--git-path', path)
+ else
+ # Git < 2.5 doesn't support linked worktrees anyway.
+ File.join(invoke(:rev_parse, '--git-dir'), path)
+ end
+ end
+
def commit(message, *args)
cmd = 'git commit --no-verify'
if message # allow nil
message_file = Tempfile.new('braid_commit')
message_file.print("Braid: #{message}")