-
Notifications
You must be signed in to change notification settings - Fork 2.6k
rebase with --rebase-merges fails to create refs with valid names #2307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That looks to be an awkward problem with the need to create a ref with a label that has a forbidden Windows character in it "Merged-PR-183:-Handling-for-message". (I haven't followed through to the source of that label - I presume it was a merge commit message title - not sure who auto created that). I think it's from the line L3221 in sequencer.c (line counts from commit 41c74b1 on origin/vs/master). Not sure if the labels should be sanitised as the best course of action (on Windows). They are only 'temporary' IIUC. |
I agree with your determination of the cause. The commit message was auto-generated by Microsoft's Azure Dev Ops server. I'm not really sure what the best course of action would be, but I strongly feel that --rebase-merges should not break due to fairly innocuous commit messages. I think the git contribution guidelines even recommend using a colon in the first characters of the commit message for submitted patches:
|
Definitely sound like the correct course would be to also report the issue upstream, perhaps with a short patch that regularises the label (I believe there is a function somewhere that will sanitise special characters, utf-8 characters and bytes may also be an issue). The justification you have noted looks solid. |
Yes, I ran into the exact same issue a couple of times, too. @ROGERSM94 I will explain as well as I can how to fix it, because I am too busy with core priorities at my work to fix it. Install Git for Windows' SDKFirst of all, install the SDK from https://gitforwindows.org/#download-sdk and start it. Both downloading and initializing will take a while, you may want to drink a coffee or three. Patch the problem
Now, use your favorite editor to edit You will want to focus on these lines, where the branch labels are generated: https://github.com/git-for-windows/git/blob/v2.23.0.windows.1/sequencer.c#L4625-L4640 I would like to steer you in particular to https://github.com/git-for-windows/git/blob/v2.23.0.windows.1/sequencer.c#L4638-L4640, where all whitespace characters are turned into dashes. And this is where we want to make the change, e.g. extending this to also replace the colon with the dash character. Try itBuild GitYou can build it via Test itTo test this, I would suggest to extend Have a look at the most recently added test case: https://github.com/git-for-windows/git/blob/v2.23.0.windows.1/t/t3430-rebase-merges.sh#L428-L442 The structure should be relatively obvious, and by convention, you can reuse whatever was initialized in the first test case labeled If I were you, I would probably do something like this: git checkout -b colon-in-label E &&
git merge -m "colon: this should work" G &&
git rebase -fr E You can then run the test in the Git SDK Bash by switching to Open a Pull RequestYou know how that works, don't you 😄 If not, GitHub has excellent documentation: https://help.github.com/en/articles/about-pull-requests Please let us know how you fare. |
I'm a bit busy at work this week, but I'll look into trying to fix it this weekend when I'll have more time. |
@dscho do you know if is there an equivalent isBannedOnWindows() function (hopefully with a better name ;-) for use with https://github.com/git-for-windows/git/blob/v2.23.0.windows.1/sequencer.c#L4638-L4640 |
@ROGERSM94 sounds good!
@PhilipOakley no, I don't think there is any function (yet) that describes what characters are illegal for file names on Windows. That would be a bit ambiguous, too, as the set differs between FAT and NTFS (as I found out recently, for example, We do have I guess we could go the whole nine yards and just convert everything non-alphanumerical into dashes. That would be the simplest safe solution, in my opinion. |
dscho wrote
My one concern is if we have utf-8 in the commit subject characters - and what is the best way of sanitizing them..? (worst case they are non core ASCII, so we just get 'n' dashes, which becomes another potential hazard (lots of identical labels), never mind folks who have lots of "WIP: merge" commits ;-) Probably just start with the basics of the core NTFS invalid chars. |
Good point. All UTF-8 characters that are not ASCII have bit |
The only other time that this problem presents itself which your fix wouldn't address is when you hit windows reserved filenames (e.g. CON, NuL, LPT, NUL.txt, etc.) but (after the suggested fix) this would require a commit with the oneline consisting of only those invalild filenames, it's probably unlikely to appear. but could be easily resolved by appending an '_' or other innocuous character to the end of the label name |
An apology..
I was mistaken that utf-8 simply used the sign bit for the higher order bytes for code points beyond 7 bits. That would have left the last byte with the sign bit not set, as per usage in varints etc., so my follow up to the comment was wrong (that if colon = 003A, then what about say 203A.. thought fail..) https://en.wikipedia.org/wiki/UTF-8 "Moreover, 7-bit bytes (bytes where the most significant bit is 0) never appear in a multi-byte sequence, and no valid multi-byte sequence decodes to an ASCII code-point." Sorry for any misunderstandings. |
@ROGERSM94 maybe you would have time to test the latest snapshot? https://wingit.blob.core.windows.net/files/index.html |
I should probably be able to get that done later tonight |
Were you able to test this? |
Yeah sorry about that it seemed to work great now
…On Tue, Sep 17, 2019, 5:54 AM Johannes Schindelin ***@***.***> wrote:
I should probably be able to get that done later tonight
Were you able to test this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2307?email_source=notifications&email_token=ABLUOJQWHJ2VPYFSRQW65QDQKDARDA5CNFSM4IPPPIEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD64IT5A#issuecomment-532187636>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABLUOJQETZ7ESD5PCZ6DBMDQKDARDANCNFSM4IPPPIEA>
.
|
Setup
defaults?
to the issue you're seeing?
Nothing that I would believe would be of interest
Details
CMD
Minimal, Complete, and Verifiable example
this will help us understand the issue.
A normal rebase procedure with or without merge conflicts
I got the following output :
Which was resolved after manually replacing all refs with the colon (':') character with a valid character. This led me to believe that the auto-generated labels led to invalid refnames, one would expect the auto-generated refs to be valid.
URL to that repository to help us with testing?
The text was updated successfully, but these errors were encountered: