{"thread":{"id":"60281","subject":"Git log bug","startedAt":"2023-09-29T09:35:41Z","lastAt":"2023-09-29T15:12:58Z","messageCount":2,"participants":["liangxiong zhu","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"482449","messageId":"LV2PR19MB5767BB3F887CDB46F571656DAFC0A@LV2PR19MB5767.namprd19.prod.outlook.com","threadId":"60281","inReplyTo":null,"subject":"Git log bug","fromName":"liangxiong zhu","fromEmail":"lxzhu@outlook.com","sentAt":"2023-09-29T09:35:33Z","receivedAt":"2023-09-29T09:35:41Z","isPatch":false,"sender":{"key":"lxzhu@outlook.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\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\ngit clone $repo_url $repo_name\ncd $repo_name\nmkdir dir01\nmkdir dir02\ntouch dir01/file01.txt\ngit add .\ngit commit -m 'Add file01.txt'\ngit push\n\ntouch dir02/file02.txt\ngit add .\ngit commit -m 'Add file02.txt'\ngit push\n\ngit log -1 -- dir01\n\nWhat did you expect to happen? (Expected behavior)\nprint out commit with message 'Add file01.txt'\n\nWhat happened instead? (Actual behavior)\nprint out commit with message 'Add file02.txt'\n\nWhat's different between what you expected and what actually happened?\n\nI would like to get the last commit to a specified directory in the repo, But I get the last commit of the whole repo\n\nAnything else you want to add:\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.42.0\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Linux 5.15.0-1036-azure #43-Ubuntu SMP Wed Mar 29 16:11:05 UTC 2023 x86_64\ncompiler info: gnuc: 11.4\nlibc info: glibc: 2.35\n$SHELL (typically, interactive shell): <unset>\n\n\n[Enabled Hooks]"},{"id":"482450","messageId":"xmqqil7thv2r.fsf@gitster.g","threadId":"60281","inReplyTo":"LV2PR19MB5767BB3F887CDB46F571656DAFC0A@LV2PR19MB5767.namprd19.prod.outlook.com","subject":"Re: Git log bug","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-09-29T15:12:44Z","receivedAt":"2023-09-29T15:12:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"liangxiong zhu <lxzhu@outlook.com> writes:\n\n> git clone $repo_url $repo_name\n> cd $repo_name\n> mkdir dir01\n> mkdir dir02\n> touch dir01/file01.txt\n> git add .\n> git commit -m 'Add file01.txt'\n> git push\n>\n> touch dir02/file02.txt\n> git add .\n> git commit -m 'Add file02.txt'\n> git push\n>\n> git log -1 -- dir01\n>\n> What did you expect to happen? (Expected behavior)\n> print out commit with message 'Add file01.txt'\n>\n> What happened instead? (Actual behavior)\n> print out commit with message 'Add file02.txt'\n\nThanks, but it does not reproduce with the above procedure.\nFollowing the above (with $repo_name set to \"trash\" that is not a\nname of any existing directory in the current directory, and\n$repo_url set to a local repository that exists but without any\nhistory), I got the \"Add file01.txt\" from the last step.\n\nI got\n\n    No refs in common and none specified; doing nothing.\n    Perhaps you should specify a branch.\n    fatal: the remote end hung up unexpectedly\n    error: failed to push some refs to '/var/tmp/x/./empty.git'\n\nafter both of \"git push\", but becuase \"git log\" that does not say\nwhere to start cares only about HEAD, in the above reproduction\nprecipe \"git push\" should be irrelevant (i.e., if your copy of Git\nis broken to exhibit the above reported bug, it should show the same\nsymptom without these steps to run \"git push\").\n\nIf there are some hooks that modifies the history after your \"git\npush\", it would be a different story, but otherwise I am not sure\nhow any version of Git would exhibit such a symptom.\n\nPuzzled.\n"}]}