Skip to content

git absorb seems to ignore git CLI config override options #187

@gibson042

Description

@gibson042

The git CLI supports overriding configuration with options like -c absorb.fixupTargetAlwaysSHA, but these appear to be ignored by git-absorb (unlike GIT_CONFIG_GLOBAL/GIT_CONFIG_SYSTEM environment variables, which seem to be respected):

$ AWK_SCAN_OUTPUT='  
/would have committed/ {
  if(match($0, /[0-9a-fA-F]{8,}/)) by_hash++; else by_subject++;
}
END {
  printf "%d by hash, %d by subject\n", by_hash, by_subject;
}
'

$ git absorb --dry-run 2>&1 | awk "$AWK_SCAN_OUTPUT"
0 by hash, 2 by subject

$ git -c absorb.fixupTargetAlwaysSHA absorb --dry-run 2>&1 | awk "$AWK_SCAN_OUTPUT"
0 by hash, 2 by subject

$ printf '[absorb]\n    fixupTargetAlwaysSHA = true\n' > /tmp/dummy-gitconfig

$ cat /tmp/dummy-gitconfig 
[absorb]
    fixupTargetAlwaysSHA = true

$ GIT_CONFIG_GLOBAL=/tmp/dummy-gitconfig git absorb --dry-run 2>&1 | awk "$AWK_SCAN_OUTPUT"
2 by hash, 0 by subject

Reading the source code suggests to me that the issue is probably in either git2 or in this code's use of it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstreamBlocked on upstream libgit2/git2rs

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions