Closed TrueDoctor closed 2 weeks ago
Thanks for reporting. This is happening during working copy snapshotting, where we run
git status --porcelain=v2 --untracked-files=no -z
ASCII character 35
= #
. This is a valid beginning of a status line when you ask for metadata, like with --branch
. However, git-branchless doesn't intend to ask for such metadata, so it fails to parse this. @TrueDoctor if you run the above git status
command, what does it print? Does it include any lines with #
in the output?
@arxanas This is the output:
# stash 3
@TrueDoctor That output should only appear if --show-stash
is passed: https://git-scm.com/docs/git-status#_stash_information
Do you have any configuration or aliases that might cause it to appear without passing that flag?
As a fix, we could probably just ignore #
lines for now. I had a more robust git status
parser somewhere which might also handle this case.
I've found this in my git config:
[status]
branch = true
showStash = true
Clearing the stash fixes it (will try to test disabling the option as well) Thanks!
Thanks for confirming. The best fix is probably to update git-branchless to support #
. IIRC it should be pretty simple if you want to give it a try; I think there's already a match
statement where we match on the first character and handle 1
/2
/u
?
I do wonder if this should be considered a bug in Git. It seems to me like porcelain output should ignore the user configuration for these settings, precisely so that scripts can be written against it without worrying about these kinds of environment differences.
Can you give me a rough location where I should look for the fix?
Sorry just came back from a trip but should now have some time to work on this. It looks like #
is valid per spec: https://git-scm.com/docs/git-status#_porcelain_format_version_2 and denotes header lines and can be ignored by parsers
Description of the bug
When executing
git prev
I get this error:This happens when using the version of git branchless get on nixos. This is the repo for which it fails: https://github.com/GraphiteEditor/Graphite
Expected behavior
No response
Actual behavior
No response
Version of
rustc
No response
Automated bug report
Software version
git-branchless 0.8.0
Operating system
Linux 6.10.3
Command-line
Environment variables
Git version
Hooks
Show 7 hooks
##### Hook `post-applypatch` ``` #!/bin/sh ## START BRANCHLESS CONFIG git branchless hook post-applypatch "$@" ## END BRANCHLESS CONFIG ``` ##### Hook `post-checkout` ``` #!/bin/sh ## START BRANCHLESS CONFIG git branchless hook post-checkout "$@" ## END BRANCHLESS CONFIG ``` ##### Hook `post-commit` ``` #!/bin/sh ## START BRANCHLESS CONFIG git branchless hook post-commit "$@" ## END BRANCHLESS CONFIG ``` ##### Hook `post-merge` ``` #!/bin/sh ## START BRANCHLESS CONFIG git branchless hook post-merge "$@" ## END BRANCHLESS CONFIG ``` ##### Hook `post-rewrite` ``` #!/bin/sh ## START BRANCHLESS CONFIG git branchless hook post-rewrite "$@" ## END BRANCHLESS CONFIG ``` ##### Hook `pre-auto-gc` ``` #!/bin/sh ## START BRANCHLESS CONFIG git branchless hook pre-auto-gc "$@" ## END BRANCHLESS CONFIG ``` ##### Hook `reference-transaction` ``` #!/bin/sh ## START BRANCHLESS CONFIG # Avoid canceling the reference transaction in the case that `branchless` fails # for whatever reason. git branchless hook reference-transaction "$@" || ( echo 'branchless: Failed to process reference transaction!' echo 'branchless: Some events (e.g. branch updates) may have been lost.' echo 'branchless: This is a bug. Please report it.' ) ## END BRANCHLESS CONFIG ```Events
Show 5 events
##### Event ID: 489, transaction ID: 1262 (message: hook-post-checkout) 1. `RefUpdateEvent { timestamp: 1726830626.292588, event_tx_id: EventTransactionId(1262), ref_name: ReferenceName("HEAD"), old_oid: 02c31d94ac82864e78247814f7c32a0be798e5b7, new_oid: ca0d1022961569b73b2f7514126f9ef53f8b2c65, message: None }` ``` : O 8fa46ba 231d xxxx xx xxxxxx xxxxx xxx xxxxxxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxxxxxx |\ | o cab8c49 229d (redacted-ref-0) xxx xxxxxxxxxxxxx xxxx xxx xxxxx xxxxx xxxxxx xx xxxxx xxxxxxx | O 349ec5d 229d (redacted-ref-1) xxx xxxxxxxxxxxxx xxxx xxx xxxxx xxxxx xxxxxx xx xxxxx xxxxxxx : -- truncated because the comment was too long for github ```Version of
git-branchless
git-branchless-opts 0.8.0
Version of
git
git version 2.44.1