{"thread":{"id":"58442","subject":"git fetch --unshallow does not work as expected to remove all the limitations imposed by shallow repositories","startedAt":"2022-09-16T07:29:20Z","lastAt":"2022-09-16T07:29:20Z","messageCount":1,"participants":["周少坤"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"463071","messageId":"CAGxGspHE2o5KgBWLF6cM56bWgbw8tDZwM+RuFmxGDZ+Vn466Bw@mail.gmail.com","threadId":"58442","inReplyTo":null,"subject":"git fetch --unshallow does not work as expected to remove all the limitations imposed by shallow repositories","fromName":"周少坤","fromEmail":"zhoushaokunixx@gmail.com","sentAt":"2022-09-16T07:29:03Z","receivedAt":"2022-09-16T07:29:20Z","isPatch":false,"sender":{"key":"zhoushaokunixx@gmail.com","avatar":null},"body":"Thank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nI just can't figure out the effect of the command `git fetch --unshallow`.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\nI downloaded a repo with a shallow clone. Then in my repo's $GIT_DIR,\nI get a file named 'shallow' which I found its description in website\n'https://git-scm.com/docs/shallow':\n> $GIT_DIR/shallow lists commit object names and tells Git to pretend as if they are root commits\n> (e.g. \"git log\" traversal stops after showing them; \"git fsck\" does not complain saying the commits listed on their \"parent\" lines do not exist).\nWhen I execute 'git fetch --depth=x' to fetch more history. There is\nno doubt that the $GIT_DIR/shallow file exists and lists some commit\nobjects.\nAll of the above steps act as expected.\nNext, as the doc of 'git fetch --unshallow' described in website\n'https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt---unshallow':\n> If the source repository is complete, convert a shallow repository to a complete one, removing all the limitations imposed by shallow repositories.\n> If the source repository is shallow, fetch as much as possible so that the current repository has the same history as the source repository.\nso I execute the command of 'git fetch --unshallow' in my repository\nto fetch all commit history.\nHowever, the strange thing is that the shallow file still exists in $GIT_DIR.\n\nWhat did you expect to happen? (Expected behavior)\nAs the document says: \"If the source repository is complete, convert a\nshallow repository to a complete one, removing all the limitations\nimposed by shallow repositories.\"\nSo, I think the '$GIT_DIR/shallow' file will be deleted after\nexecuting 'git fetch --unshallow' which corresponds to 'removing all\nthe limitations imposed by shallow repositories.'\n\nWhat happened instead? (Actual behavior)\nAnd when I execute 'git fetch --unshallow' again, the\n'$GIT_DIR/shallow' file is not removed.\nWhat's different between what you expected and what actually happened?\nThe '$GIT_DIR/shallow' is whether it exists or not after executing\n'git fetch --unshallow'.\nIn my developing application, I use the existence of the\n'$GIT_DIR/shallow' file to mark whether a repo's commit history is\ncompletely fetched from a remote source which is really important for\nme.\nI also tried adding the '--update-shallow' argument which all commands\nare 'git fetch --unshallow --update-shallow'. But the\n'$GIT_DIR/shallow' file still existed.\nBut when I try 'git fetch --unshallow --update-shallow' again, the\nfile will be removed.\nSo for now, I just execute 'git fetch --unshallow --update-shallow',\nand check if '$GIT_DIR/shallow' exists.\nIf not, the program will return.\nIf it exists, I execute 'git fetch --unshallow --update-shallow' again\nto make sure the  '$GIT_DIR/shallow' file is deleted.\n\nAnything else you want to add:\nMaybe it's a bug of 'git fetch'.\nIf not, I will appreciate it if any guys can give me some ways to\ncheck whether the commit history of one repository which was shallowly\ncloned earlier is completely fetched.\nThanks for your reply.\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.36.1.windows.1\ncpu: x86_64\nbuilt from commit: e2ff68a2d1426758c78d023f863bfa1e03cbc768\nsizeof-long: 4\nsizeof-size_t: 8\nshell-path: /bin/sh\nfeature: fsmonitor--daemon\nuname: Windows 10.0 19042\ncompiler info: gnuc: 11.3\nlibc info: no libc information available\n$SHELL (typically, interactive shell):\nE:\\projects\\ugit\\ugit\\dist\\UGit-dev-win32-x64\\resources\\app\\git\\usr\\bin\\bash.exe\n\n\n[Enabled Hooks]\n"}]}