Skip to content

Formatting changes should preserve original attribution (v1.1.1) #494

@txf0096

Description

@txf0096

Version

git-ai v1.1.1

Expected Behavior

When formatting code (adding/removing whitespace), the attribution should be preserved from the original author, regardless of who makes the formatting change.

Test Case 1: Human formats AI code

# 1. AI writes code with spaces
cat > test.py << 'EOF'
def foo():
    return    1
EOF
git add test.py
git-ai checkpoint mock_ai test.py
git commit -m "AI: initial code"

# git-ai blame:
# de8455b (mock_ai ... 2)     return    1
# stats: 0% you, 100% ai ✓

# 2. Human removes spaces  
cat > test.py << 'EOF'
def foo():
    return 1
EOF
git add test.py
git commit -m "Human: format code"

# git-ai blame:
# 8fca055 (Test User ... 2)     return 1
# stats: 100% you, 0% ai ✗

Expected: Line 2 should preserve mock_ai attribution
Actual: Line 2 changes to Test User attribution

Test Case 2: AI formats Human code

# 1. Human writes code
cat > test.py << 'EOF'
def foo():
    return 1
EOF
git add test.py
git commit -m "Human: initial code"

# git-ai blame:
# eb055b7 (Test User ... 2)     return 1
# stats: 100% you, 0% ai ✓

# 2. AI adds spaces
cat > test.py << 'EOF'
def foo():
    return    1
EOF
git add test.py
git-ai checkpoint mock_ai test.py
git commit -m "AI: format code"

# git-ai blame:
# f06eb85 (Test User ... 2)     return    1
# stats: 100% you, 0% ai ✓

Expected: Line 2 should preserve Test User attribution
Actual: Line 2 correctly preserves Test User attribution ✓

Summary

Test Case 1 is problematic - when a human formats AI code, the attribution incorrectly changes to the human. Test Case 2 works correctly - AI formatting human code preserves the human attribution.

For consistency, both formatting operations should preserve the original attribution using INHERIT rules, but currently only Test Case 2 works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions