Created
March 14, 2012 05:28
-
-
Save atnan/2034294 to your computer and use it in GitHub Desktop.
Git post-checkout hook demoing how one might achieve branch-specific Xcode breakpoints
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
previous_sha, current_sha, branch_checkout, _ = *ARGV | |
exit if branch_checkout == 0 || previous_sha == current_sha | |
begin | |
require 'pathname' | |
require 'fileutils' | |
root = Pathname.new(%x( git rev-parse --show-toplevel ).strip) | |
Pathname.glob(root.join("**", "Breakpoints.xcbkptlist")).each do |breakpoint| | |
# Breakpoints.xcbkptlist -> .SHA-Breakpoints.xcbkptlist | |
FileUtils.mv(breakpoint, breakpoint.dirname.join(".#{previous_sha}-#{breakpoint.basename}")) | |
end | |
Pathname.glob(root.join("**", ".#{current_sha}-Breakpoints.xcbkptlist")) do |breakpoint| | |
# .SHA-Breakpoints.xcbkptlist -> Breakpoints.xcbkptlist | |
FileUtils.mv(breakpoint, breakpoint.dirname.join("Breakpoints.xcbkptlist")) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment