Skip to content

Feature Request: Use saved -n parameter when viewing specific branches #182

@j0vand

Description

@j0vand

Problem Description

When viewing a specific branch by clicking the "Show" button next to a branch tip, the extension always uses a hardcoded -n 15000 parameter, regardless of the -n value saved in the main view configuration. This causes performance issues when working with repositories that have very long commit histories, as the extension loads 15,000 commits even if the user has configured a smaller value (e.g., -n 1000) in the main view.

Use Case

  1. User opens GitLG and configures the main log command with -n 1000 (or any other value) to improve performance
  2. User saves this configuration
  3. User clicks on a commit to view its details
  4. User clicks "Show" button next to a branch tip in the commit details panel
  5. Issue: The extension loads 15,000 commits instead of using the saved -n 1000 value, causing the same performance problems the user was trying to avoid

Current Behavior

  • The main view respects the saved -n parameter from the "Configure..." panel
  • When clicking "Show" on a branch tip, it always uses -n 15000 (hardcoded in web/src/data/store/index.js, line 98)

Expected Behavior

When clicking "Show" on a branch tip, the extension should:

  1. Check if the user has saved a custom -n parameter in the main log configuration
  2. If found, use that saved value instead of the hardcoded 15000
  3. Fall back to 15000 only if no custom configuration exists

Proposed Solution

Modify the show_branch function in web/src/data/store/index.js to read the saved configuration from state('git input config main-log') and extract the -n parameter value from the saved command string.

Example implementation approach:

export let show_branch = (/** @type {Branch} */ branch_tip) => {
  // Read saved configuration
  let saved_config = state('git input config main-log', { command: '', options: [] }).ref
  let n_value = '15000' // default fallback
  if (saved_config.value?.command) {
    // Extract -n parameter from saved command
    let match = saved_config.value.command.match(/-n\s+(\d+)/)
    if (match) {
      n_value = match[1]
    }
  }
  return trigger_main_refresh({
    custom_log_args: ({ base_log_args }) =>
      `${base_log_args} -n ${n_value} ${branch_tip.id}`,
    fetch_stash_refs: false,
  })
}

Additional Context

  • This issue affects users with large repositories where loading 15,000 commits causes noticeable lag
  • The workaround of manually editing the command in "Configure..." works for the main view, but doesn't help when viewing specific branches
  • Similar behavior might also exist in show_commit_hash function (line 106), which uses -n 500 - though this might be intentional for commit-specific views

Related Files

  • web/src/data/store/index.js (lines 95-100: show_branch function)
  • web/src/components/GitInput.vue (handles saving/loading configuration)
  • web/src/data/store/repo.js (defines log_action with storage_key: 'main-log')

Thank you for considering this feature request! This would significantly improve the user experience when working with large repositories.

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