dbf0b1cf45d7 — Sean Farley 0.1 12 years ago
fast-bookmark: fallback to using branchname if no bookmark is active
1 files changed, 6 insertions(+), 1 deletions(-)

M fast-hg-bookmark.c
M fast-hg-bookmark.c +6 -1
@@ 53,7 53,12 @@ int cat_file(const char *hg_path, const 
 }
 
 int parse_bookmarks(const char *hg_path) {
-  return cat_file(hg_path, "bookmarks.current");
+  if (cat_file(hg_path, "bookmarks.current")) {
+    /* fallback to branch name if bookmark isn't active */
+    return cat_file(hg_path, "branch");
+  }
+
+  return 0;
 }
 
 int main() {