Skip to content

[BUG] Layout config is ignored for repositories with no commits #141

Description

@janbuchar

Describe the bug

When a repository has no commits yet (IsInitial: true), the layout configuration is completely ignored. The output format is hardcoded in formater.go:

if f.st.IsInitial {
    branch := truncate(f.st.LocalBranch, f.Options.Ellipsis, f.Options.BranchMaxLen, f.Options.BranchTrim)
    s := fmt.Sprintf("%s%s%s [no commits yet] %s", f.Styles.Clear, f.Styles.Branch, branch, f.flags())
    _, err := io.WriteString(w, s)
    return err
}

This means any custom layout (leading/trailing strings, component ordering, etc.) has no effect on repos in this state.

To Reproduce

  1. Create a config with a custom layout, e.g.:
    layout: [' ', flags, ' ', branch, ' ']
  2. Run gitmux in a repository with no commits (git init with nothing committed).
  3. The output ignores the layout and renders the hardcoded format instead.

Expected behavior

The layout config should be respected for initial repositories as well, or at minimum the hardcoded format should be consistent with the user's layout (e.g. preserving leading/trailing literal strings).

Environment:

  • gitmux version: 0.11.5
  • OS: Linux

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions