Skip to content

bug(update): install.sh update path crashes when ~/.local/share/budjira is not a git checkout #98

Closed

Description

@f3rdy

Problem

budjira update fails with:

✗ Update failed: fatal: not a git repository (or any of the parent directories): .git

Root cause

perform_update() (budjira/utils/version.py:174-179) runs
curl -LsSf https://raw.githubusercontent.com/cdds-ab/budjira/master/install.sh | sh.

install.sh gates its update path on directory existence, not on the
directory being a git checkout:

# install.sh:41
if [ -d "$INSTALL_DIR" ]; then      # $INSTALL_DIR = ~/.local/share/budjira
    cd "$INSTALL_DIR"
    git fetch --quiet origin        # fails if there is no .git here
    git reset --hard origin/master --quiet
    git clean -fd --quiet
else
    git clone ... "$INSTALL_DIR"
fi

When ~/.local/share/budjira exists but is not a git checkout (interrupted
or corrupted earlier install, missing .git), the update branch is taken and
git fetch aborts with "not a git repository".

Reproduce

mkdir -p /tmp/x && cd /tmp/x && git fetch --quiet origin
# fatal: not a git repository (or any of the parent directories): .git

Fix

Gate on $INSTALL_DIR/.git instead of $INSTALL_DIR, and self-heal: if a
non-git directory exists, remove it and re-clone.

if [ -d "$INSTALL_DIR/.git" ]; then
    cd "$INSTALL_DIR"
    git fetch --quiet origin
    git reset --hard origin/master --quiet
    git clean -fd --quiet
else
    [ -d "$INSTALL_DIR" ] && rm -rf "$INSTALL_DIR"   # heal non-git dir
    mkdir -p "$(dirname "$INSTALL_DIR")"
    git clone --quiet https://github.com/cdds-ab/budjira.git "$INSTALL_DIR"
    cd "$INSTALL_DIR"
fi

No release needed

install.sh is fetched live from master at update time (hardcoded URL in
version.py:174) and is not part of the installed package. The fix takes effect
for every budjira update as soon as it lands on master — no version bump.

Workaround until merged

rm -rf ~/.local/share/budjira
curl -LsSf https://raw.githubusercontent.com/cdds-ab/budjira/master/install.sh | sh

Activity

  1. added
    bug
    on Jul 17, 2026
  2. github-actions commented on Jul 17, 2026

    @github-actions

    Sensitive Data Detected

    This repository is PUBLIC! Please remove sensitive information.

    Found potential issues:

    • Company names: Use company instead

    Action needed:

    1. Edit this issue
    2. Replace sensitive data with dummy values
    3. Common replacements:
      • Email: user@example.com
      • Customer: acme-corp
      • URL: company.atlassian.net
      • Person: john.doe

    @f3rdy Please sanitize this issue!

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

    bugneeds-sanitization

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions