{"thread":{"id":"62737","subject":"Full absolute path in a commit makes checkout fail","startedAt":"2025-01-04T14:21:48Z","lastAt":"2025-01-05T12:58:09Z","messageCount":3,"participants":["Youtian WANG","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"509909","messageId":"TYCPR01MB1173678128DCC128099726865AB162@TYCPR01MB11736.jpnprd01.prod.outlook.com","threadId":"62737","inReplyTo":null,"subject":"Full absolute path in a commit makes checkout fail","fromName":"Youtian WANG","fromEmail":"wangyoutian@msn.com","sentAt":"2025-01-04T14:21:46Z","receivedAt":"2025-01-04T14:21:48Z","isPatch":false,"sender":{"key":"wangyoutian@msn.com","avatar":null},"body":"In a commit of a public repo (which might still require a sign in using github account, etc, due to possibly the service maintainer's configuration):\n\nhttps://gitee.com/whyyouteach/erg4eye/commit/f5e2c1ea25aaee24868a1790cf59ccd0a8288c3c\n\n, a file of full absolute path (including the volume, also known as drive letter, in windows operating system) shows up:\n\nC:\\erg4eye_3\\xiangxun23080202 \n\n; I'm not sure how that path gets into the repo, as this is a repo for a pack of students. Maybe it's due to a 3rd party tool, or a direct upload via the web page of the git service.  I noticed that in:\n\nhttps://github.com/gitkraken/vscode-gitlens/issues/932\n\n, some similar issues appeared involving a vsCode extension for git.\n\nI cannot checkout outWith the above described commit; the error message is:\n\nerror: invalid path 'C:\\erg4eye_3\\xiangxun23080202' \n\n;\n\nMy question is: \n1) Per git design, such full absolute is not allowed as it might be out of repo, right?\n2) If it's done by a 3rd party tool which might be buggy, git.exe or the git server would bury the problem in the repo history as long as it's not checked out. As a git hosting service wouldnot bother to check it out, hence it will not be an issue with the server. But once it's cloned and that commit is checked out, an issue would emerge.  Is this understanding correct?\n\nThanks,\n\nYoutian Wang\n"},{"id":"509914","messageId":"Z3lsJZt-9N9IWoe-@tapette.crustytoothpaste.net","threadId":"62737","inReplyTo":"TYCPR01MB1173678128DCC128099726865AB162@TYCPR01MB11736.jpnprd01.prod.outlook.com","subject":"Re: Full absolute path in a commit makes checkout fail","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2025-01-04T17:13:09Z","receivedAt":"2025-01-04T17:19:15Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2025-01-04 at 14:21:46, Youtian WANG wrote:\n> In a commit of a public repo (which might still require a sign in using github account, etc, due to possibly the service maintainer's configuration):\n> \n> https://gitee.com/whyyouteach/erg4eye/commit/f5e2c1ea25aaee24868a1790cf59ccd0a8288c3c\n> \n> , a file of full absolute path (including the volume, also known as drive letter, in windows operating system) shows up:\n> \n> C:\\erg4eye_3\\xiangxun23080202 \n> \n> ; I'm not sure how that path gets into the repo, as this is a repo for a pack of students. Maybe it's due to a 3rd party tool, or a direct upload via the web page of the git service.  I noticed that in:\n> \n> https://github.com/gitkraken/vscode-gitlens/issues/932\n> \n> , some similar issues appeared involving a vsCode extension for git.\n> \n> I cannot checkout outWith the above described commit; the error message is:\n> \n> error: invalid path 'C:\\erg4eye_3\\xiangxun23080202'\n> \n> ;\n> \n> My question is:\n> 1) Per git design, such full absolute is not allowed as it might be out of repo, right?\n\nThis is not a full absolute path as Git stores it.  Git uses the\nstandard Unix slash character, and only that character, as the path\nseparator internally, unless you're on Windows.  So this is a single\nfile in the top-level of the repository called\n`C:\\erg4eye_3\\xiangxun23080202`.\n\nI'm on Linux, and I did this to test, and it works just fine:\n\n----\n$ git init test-repo\nInitialized empty Git repository in /tmp/user/1000/test-repo/.git/\n$ cd test-repo\n$ touch 'C:\\erg4eye_3\\xiangxun23080202'\n$ git add C:\\\\erg4eye_3\\\\xiangxun23080202\n$ git commit -m +\n[dev (root-commit) 0d1da07] +\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 \"C:\\\\erg4eye_3\\\\xiangxun23080202\"\n----\n\nNow, this clearly won't work on Windows, as you pointed out, but nor\nwill a file called `aux.h`, and we wouldn't want to exclude that from\nworking (Linux contains such a file, for instance).  Windows contains a\nvariety of filenames that are unacceptable for various reasons and users\nnot using Windows shouldn't be negatively affected because of its\nless capable handling of filenames.\n\nI assume you're on Windows, so you could try using WSL to verify that it\nworks just fine on Linux, provided you do it on a native Linux volume\n(and not on a Windows one).\n\n> 2) If it's done by a 3rd party tool which might be buggy, git.exe or the git server would bury the problem in the repo history as long as it's not checked out. As a git hosting service wouldnot bother to check it out, hence it will not be an issue with the server. But once it's cloned and that commit is checked out, an issue would emerge.  Is this understanding correct?\n\nAgain, I don't think \"buggy\" is the right word, but it will remain\nhidden until you attempt to check it out _on a Windows system_.  Some\nhosting platforms contain checks for paths that are problematic on\nvarious OSes, such as pairs of files that differ only in case, so it may\nbe caught on push to such a platform as well.\n-- \nbrian m. carlson (they/them or he/him)\nToronto, Ontario, CA\n"},{"id":"509928","messageId":"TYCPR01MB11736EEBE8552070648620C99AB172@TYCPR01MB11736.jpnprd01.prod.outlook.com","threadId":"62737","inReplyTo":"Z3lsJZt-9N9IWoe-@tapette.crustytoothpaste.net","subject":"Re: Full absolute path in a commit makes checkout fail","fromName":"Youtian WANG","fromEmail":"wangyoutian@msn.com","sentAt":"2025-01-05T12:58:08Z","receivedAt":"2025-01-05T12:58:09Z","isPatch":false,"sender":{"key":"wangyoutian@msn.com","avatar":null},"body":"Bingo, this clearly and completely solved the problem that were on my mind for quite a while. \n\nThanks, Mr. Carlson!\n\nYoutian Wang"}]}