Skip to content

[BUG] Can't use git branch name if branch contains '#' character #516

Description

@neyhden

When the option git_use_branch_name is enabled, trying to save the session will result in an error "No alternate file name to substitute for '#'.

Steps to reproduce the behavior:

  1. Set git_use_branch_name to true.
  2. Switch to a git branch with character '#' in the name.
  3. Try to save session.

Expected behavior
The session should save correctly and the '#' character should be escaped in the title as the rest of the special characters.

Checkhealth

auto-session: ✅

Setup ~

  • ✅ OK setup() called

Lazy.nvim settings ~

  • ✅ OK Lazy.nvim support is enabled
  • ✅ OK auto-session is not lazy loaded

Config ~

  • ✅ OK No config issues detected

Current Config ~

  • {
    args_allow_files_auto_save = false,
    args_allow_single_directory = true,
    auto_create = true,
    auto_delete_empty_sessions = true,
    auto_restore = true,
    auto_restore_last_session = false,
    auto_save = true,
    bypass_save_filetypes = { "neo-tree", "alpha", "dashboard", "snacks_dashboard" },
    close_filetypes_on_save = { "checkhealth", "neo-tree" },
    close_unsupported_windows = true,
    continue_restore_on_error = false,
    cwd_change_handling = false,
    enabled = true,
    git_auto_restore_on_branch_change = false,
    git_use_branch_name = true,
    lazy_support = true,
    legacy_cmds = true,
    log_level = "error",
    lsp_stop_on_restore = false,
    post_restore_cmds = { "let buf=bufnr('%') | exec 'bufdo #' | exec 'b' buf", "Neotree show" },
    root_dir = "/home/eherabr/.local/share/nvim/sessions/",
    session_lens = {
    load_on_setup = true,
    mappings = {
    alternate_session = { "i", "" },
    copy_session = { "i", "" },
    delete_session = { "i", "" }
    },
    previewer = "summary",
    session_control = {
    control_dir = "/home/eherabr/.local/share/nvim/auto_session/",
    control_filename = "session_control.json"
    }
    },
    show_auto_restore_notif = false,
    single_session_mode = false
    }

General Info ~

  • Session directory: /home/eherabr/.local/share/nvim/sessions/
  • Current session:
  • Current session file:
  • Selected picker: telescope

Baseline (please complete the following information):

  • Result of set sessionoptions?: blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions
  • OS. e.g uname -a: Fedora linux 43, Linux 6.19.9-200.fc43.x86-64
  • Neovim version nvim --version v0.11.6
  • URL to your current config (if public): https://github.com/neyhden/config

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions