{"thread":{"id":"54414","subject":"git diff --submodule=diff and --stat/--dirstat/--name-only","startedAt":"2020-10-14T10:15:27Z","lastAt":"2020-10-15T01:30:44Z","messageCount":5,"participants":["Marc Sune","Philippe Blain"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"407501","messageId":"CA+3n-TrVncSq6kY8sTTw=LiOvLKe=6k1yBE8cmmR3i40CaXR6w@mail.gmail.com","threadId":"54414","inReplyTo":null,"subject":"git diff --submodule=diff and --stat/--dirstat/--name-only","fromName":"Marc Sune","fromEmail":"marcdevel@gmail.com","sentAt":"2020-10-14T10:14:14Z","receivedAt":"2020-10-14T10:15:27Z","isPatch":false,"sender":{"key":"marcdevel@gmail.com","avatar":"https://gravatar.com/avatar/e6b0073d3a55633ff2f322ead8c22b8970926788f55bc1d0c1dc66f50adbfbee?d=mp&s=160"},"body":"Hello all,\n\nFirst, thank you to the community for the great work. Worth saying it\nfrom time to time, I think.\n\nI am dealing with a couple of big repositories that use git\nsubmodules. They have nested submodules, and some of them are pretty\nhuge. I came across:\n\ngit diff --submodule=diff\n\nWhich is very handy for creating some tooling, but it's obviously slow\n- in the order of tens of minutes in my case - for big diffs. I was\nonly interested in the list files that changed, in this particular\ncase, but:\n\ngit diff --stat --submodule=diff\n\ndoesn't seem to honour `--submodule=diff` and it doesn't go into the\nsubmodule(s) nor recurses, of course. Other options like `--dirstat`\nor `--name-only` seem to behave the same way.\n\nI've tried this v2.20.1 and the HEAD of master (d4a392452e) with the\nsame results. Is this a missing feature, a bug or is it just the\nintended behaviour?\n\nRegards\nmarc\n"},{"id":"407506","messageId":"E3D98950-2EA1-4BFE-8A2D-CE8AEAF5AD39@gmail.com","threadId":"54414","inReplyTo":"CA+3n-TrVncSq6kY8sTTw=LiOvLKe=6k1yBE8cmmR3i40CaXR6w@mail.gmail.com","subject":"Re: git diff --submodule=diff and --stat/--dirstat/--name-only","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2020-10-14T13:29:18Z","receivedAt":"2020-10-14T13:29:23Z","isPatch":false,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hi Marc,\n\n> Le 14 oct. 2020 à 06:14, Marc Sune <marcdevel@gmail.com> a écrit :\n> \n> Hello all,\n> \n> First, thank you to the community for the great work. Worth saying it\n> from time to time, I think.\n> \n> I am dealing with a couple of big repositories that use git\n> submodules. They have nested submodules, and some of them are pretty\n> huge. I came across:\n> \n> git diff --submodule=diff\n> \n> Which is very handy for creating some tooling, but it's obviously slow\n> - in the order of tens of minutes in my case - for big diffs. I was\n> only interested in the list files that changed, in this particular\n> case, but:\n> \n> git diff --stat --submodule=diff\n> \n> doesn't seem to honour `--submodule=diff` and it doesn't go into the\n> submodule(s) nor recurses, of course. Other options like `--dirstat`\n> or `--name-only` seem to behave the same way.\n> \n> I've tried this v2.20.1 and the HEAD of master (d4a392452e) with the\n> same results. Is this a missing feature, a bug or is it just the\n> intended behaviour?\n> \n> Regards\n> marc\n\nThis would indeed be useful. It's a missing feature, and so intended behaviour\nfor the moment, I would say. It was discussed recently on the list [1] :\n\n\n[1] https://lore.kernel.org/git/20200924063829.GA1851751@coredump.intra.peff.net/t/#u\n\nCheers,\n\nPhilippe.\n\n"},{"id":"407511","messageId":"CA+3n-Tpb4BGM5W3e5vHwqkU-Tnh2gs0_K1ciEcJ25SnYe5PTOw@mail.gmail.com","threadId":"54414","inReplyTo":"E3D98950-2EA1-4BFE-8A2D-CE8AEAF5AD39@gmail.com","subject":"Re: git diff --submodule=diff and --stat/--dirstat/--name-only","fromName":"Marc Sune","fromEmail":"marcdevel@gmail.com","sentAt":"2020-10-14T14:35:25Z","receivedAt":"2020-10-14T14:35:39Z","isPatch":false,"sender":{"key":"marcdevel@gmail.com","avatar":"https://gravatar.com/avatar/e6b0073d3a55633ff2f322ead8c22b8970926788f55bc1d0c1dc66f50adbfbee?d=mp&s=160"},"body":"Philippe,\n\nMissatge de Philippe Blain <levraiphilippeblain@gmail.com> del dia\ndc., 14 d’oct. 2020 a les 15:29:\n>\n> Hi Marc,\n>\n> > Le 14 oct. 2020 à 06:14, Marc Sune <marcdevel@gmail.com> a écrit :\n> >\n> > Hello all,\n> >\n> > First, thank you to the community for the great work. Worth saying it\n> > from time to time, I think.\n> >\n> > I am dealing with a couple of big repositories that use git\n> > submodules. They have nested submodules, and some of them are pretty\n> > huge. I came across:\n> >\n> > git diff --submodule=diff\n> >\n> > Which is very handy for creating some tooling, but it's obviously slow\n> > - in the order of tens of minutes in my case - for big diffs. I was\n> > only interested in the list files that changed, in this particular\n> > case, but:\n> >\n> > git diff --stat --submodule=diff\n> >\n> > doesn't seem to honour `--submodule=diff` and it doesn't go into the\n> > submodule(s) nor recurses, of course. Other options like `--dirstat`\n> > or `--name-only` seem to behave the same way.\n> >\n> > I've tried this v2.20.1 and the HEAD of master (d4a392452e) with the\n> > same results. Is this a missing feature, a bug or is it just the\n> > intended behaviour?\n> >\n> > Regards\n> > marc\n>\n> This would indeed be useful. It's a missing feature, and so intended behaviour\n> for the moment, I would say. It was discussed recently on the list [1] :\n>\n>\n> [1] https://lore.kernel.org/git/20200924063829.GA1851751@coredump.intra.peff.net/t/#u\n\nThank you for the pointer and the clarification.\n\nI am not sure extending `git diff` options (only) under\n`--submodule=`, e.g. `--submodule=stat` is the way to go. It seems\nredundant to me.\n\nI am wondering if it would make sense to have basic options of git\ncommands, e.g. `git diff --stat`, be honoured for submodules too, and\njust control whether git commands should get in the submodule(s) or\nnot, and perhaps the depth of the recursion (optionally).\n\nFor instance, I don't fully get the use-case(s) in which parts of the\noutput are --stat (supermodule) and submodules show something\ndifferent:\n\ngit diff --stat --submodule=diff\ngit diff --stat --submodule=log\n\nSpecially for log, this sounds to me like it should be under `git\nlog`, with the appropriate options. Perhaps you can shed some light on\nthe use-cases these combinations support.\n\nI would think something like:\n\ngit diff --stat --submodule-follow\ngit diff --stat --submodule-follow-depth=4\n\ngit diff --names-only --submodule-follow\ngit diff --dirstat --submodule-follow\n\nand for other commands (some sort of header line should be printed to\nnote the history is under the submodule X):\n\ngit log --submodule-follow\ngit log --submodule-follow-depth=4\n\nand of course allowing `--` modifier:\n\ngit log --submodule-follow -- libs/library1\n\nwould be easier to use.\n\nLet me know if any of this resonates, and if some patches along these\nlines would be welcomed (might ask some help offlist).\n\nRegards\nmarc\n\n>\n> Cheers,\n>\n> Philippe.\n>\n"},{"id":"407554","messageId":"D853766B-B4D8-46B3-A3BA-68519DCFC7C5@gmail.com","threadId":"54414","inReplyTo":"CA+3n-Tpb4BGM5W3e5vHwqkU-Tnh2gs0_K1ciEcJ25SnYe5PTOw@mail.gmail.com","subject":"Re: git diff --submodule=diff and --stat/--dirstat/--name-only","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2020-10-14T22:51:33Z","receivedAt":"2020-10-15T01:20:30Z","isPatch":false,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hi Marc,\n\n> Le 14 oct. 2020 à 10:35, Marc Sune <marcdevel@gmail.com> a écrit :\n> \n> Philippe,\n> \n> Missatge de Philippe Blain <levraiphilippeblain@gmail.com> del dia\n> dc., 14 d’oct. 2020 a les 15:29:\n>> \n>> Hi Marc,\n>> \n>>> Le 14 oct. 2020 à 06:14, Marc Sune <marcdevel@gmail.com> a écrit :\n>>> \n>>> Hello all,\n>>> \n>>> First, thank you to the community for the great work. Worth saying it\n>>> from time to time, I think.\n>>> \n>>> I am dealing with a couple of big repositories that use git\n>>> submodules. They have nested submodules, and some of them are pretty\n>>> huge. I came across:\n>>> \n>>> git diff --submodule=diff\n>>> \n>>> Which is very handy for creating some tooling, but it's obviously slow\n>>> - in the order of tens of minutes in my case - for big diffs. I was\n>>> only interested in the list files that changed, in this particular\n>>> case, but:\n>>> \n>>> git diff --stat --submodule=diff\n>>> \n>>> doesn't seem to honour `--submodule=diff` and it doesn't go into the\n>>> submodule(s) nor recurses, of course. Other options like `--dirstat`\n>>> or `--name-only` seem to behave the same way.\n>>> \n>>> I've tried this v2.20.1 and the HEAD of master (d4a392452e) with the\n>>> same results. Is this a missing feature, a bug or is it just the\n>>> intended behaviour?\n>>> \n>>> Regards\n>>> marc\n>> \n>> This would indeed be useful. It's a missing feature, and so intended behaviour\n>> for the moment, I would say. It was discussed recently on the list [1] :\n>> \n>> \n>> [1] https://lore.kernel.org/git/20200924063829.GA1851751@coredump.intra.peff.net/t/#u\n> \n> Thank you for the pointer and the clarification.\n> \n> I am not sure extending `git diff` options (only) under\n> `--submodule=`, e.g. `--submodule=stat` is the way to go. It seems\n> redundant to me.\n> \n> I am wondering if it would make sense to have basic options of git\n> commands, e.g. `git diff --stat`, be honoured for submodules too, and\n> just control whether git commands should get in the submodule(s) or\n> not, and perhaps the depth of the recursion (optionally).\n\nDid you try `git submodule foreach` ? If you are scripting, you could do:\n\n    git diff --stat && git submodule foreach [--recursive] git diff --stat\n\nAlthough here the recursion is an all-or-nothing business.\n\n> For instance, I don't fully get the use-case(s) in which parts of the\n> output are --stat (supermodule) and submodules show something\n> different:\n> \n> git diff --stat --submodule=diff\n> git diff --stat --submodule=log\n> \n> Specially for log, this sounds to me like it should be under `git\n> log`, with the appropriate options.\n\nI think 'log' is useful; it's more descriptive then having just a hash,\nwhich is the default...\n\n> Perhaps you can shed some light on\n> the use-cases these combinations support.\n> \n> I would think something like:\n> \n> git diff --stat --submodule-follow\n> git diff --stat --submodule-follow-depth=4\n> \n> git diff --names-only --submodule-follow\n> git diff --dirstat --submodule-follow\n> and for other commands (some sort of header line should be printed to\n> note the history is under the submodule X):\n> \n> git log --submodule-follow\n> git log --submodule-follow-depth=4\n> \n> and of course allowing `--` modifier:\n> \n> git log --submodule-follow -- libs/library1\n> \n> would be easier to use.\n\nI'm not sure of the use case for these... The history\nof the submodule project can be seen with `git -C path/to/submodule log` \n(or just `cd` there and `git log`), and the history of the gitlink in the superproject\nwith `git log -- path/to/submodule`... \n\nIt does not really make sense to interleave the history of the superproject and\nthe submodule in the same output, in my opinion at least.\n\n> Let me know if any of this resonates, and if some patches along these\n> lines would be welcomed\n\nI can't really answer that, I'm just a small time contributor :)\n\n> (might ask some help offlist).\n\nYou should ask on the list, on the mentoring list, or on IRC (see [1]).\n\n[1] https://git-scm.com/docs/MyFirstContribution#getting-help\n\nCheers,\nPhilippe.\n\n"},{"id":"407558","messageId":"CA+3n-TrSdMAZmdew3kAQQA6CPRQi+7-LksGBNkNxFsnXsrhqjg@mail.gmail.com","threadId":"54414","inReplyTo":"D853766B-B4D8-46B3-A3BA-68519DCFC7C5@gmail.com","subject":"Re: git diff --submodule=diff and --stat/--dirstat/--name-only","fromName":"Marc Sune","fromEmail":"marcdevel@gmail.com","sentAt":"2020-10-14T22:59:41Z","receivedAt":"2020-10-15T01:30:44Z","isPatch":false,"sender":{"key":"marcdevel@gmail.com","avatar":"https://gravatar.com/avatar/e6b0073d3a55633ff2f322ead8c22b8970926788f55bc1d0c1dc66f50adbfbee?d=mp&s=160"},"body":"Philippe,\n\nMissatge de Philippe Blain <levraiphilippeblain@gmail.com> del dia\ndj., 15 d’oct. 2020 a les 0:51:\n>\n> Hi Marc,\n>\n> > Le 14 oct. 2020 à 10:35, Marc Sune <marcdevel@gmail.com> a écrit :\n> >\n> > Philippe,\n> >\n> > Missatge de Philippe Blain <levraiphilippeblain@gmail.com> del dia\n> > dc., 14 d’oct. 2020 a les 15:29:\n> >>\n> >> Hi Marc,\n> >>\n> >>> Le 14 oct. 2020 à 06:14, Marc Sune <marcdevel@gmail.com> a écrit :\n> >>>\n> >>> Hello all,\n> >>>\n> >>> First, thank you to the community for the great work. Worth saying it\n> >>> from time to time, I think.\n> >>>\n> >>> I am dealing with a couple of big repositories that use git\n> >>> submodules. They have nested submodules, and some of them are pretty\n> >>> huge. I came across:\n> >>>\n> >>> git diff --submodule=diff\n> >>>\n> >>> Which is very handy for creating some tooling, but it's obviously slow\n> >>> - in the order of tens of minutes in my case - for big diffs. I was\n> >>> only interested in the list files that changed, in this particular\n> >>> case, but:\n> >>>\n> >>> git diff --stat --submodule=diff\n> >>>\n> >>> doesn't seem to honour `--submodule=diff` and it doesn't go into the\n> >>> submodule(s) nor recurses, of course. Other options like `--dirstat`\n> >>> or `--name-only` seem to behave the same way.\n> >>>\n> >>> I've tried this v2.20.1 and the HEAD of master (d4a392452e) with the\n> >>> same results. Is this a missing feature, a bug or is it just the\n> >>> intended behaviour?\n> >>>\n> >>> Regards\n> >>> marc\n> >>\n> >> This would indeed be useful. It's a missing feature, and so intended behaviour\n> >> for the moment, I would say. It was discussed recently on the list [1] :\n> >>\n> >>\n> >> [1] https://lore.kernel.org/git/20200924063829.GA1851751@coredump.intra.peff.net/t/#u\n> >\n> > Thank you for the pointer and the clarification.\n> >\n> > I am not sure extending `git diff` options (only) under\n> > `--submodule=`, e.g. `--submodule=stat` is the way to go. It seems\n> > redundant to me.\n> >\n> > I am wondering if it would make sense to have basic options of git\n> > commands, e.g. `git diff --stat`, be honoured for submodules too, and\n> > just control whether git commands should get in the submodule(s) or\n> > not, and perhaps the depth of the recursion (optionally).\n>\n> Did you try `git submodule foreach` ? If you are scripting, you could do:\n>\n>     git diff --stat && git submodule foreach [--recursive] git diff --stat\n\nYes, ofc. There are multiple reasons for not using it in this specific\ncase I am facing (specially performance), but this is probably\nofftopic.\n\n>\n> Although here the recursion is an all-or-nothing business.\n>\n> > For instance, I don't fully get the use-case(s) in which parts of the\n> > output are --stat (supermodule) and submodules show something\n> > different:\n> >\n> > git diff --stat --submodule=diff\n> > git diff --stat --submodule=log\n> >\n> > Specially for log, this sounds to me like it should be under `git\n> > log`, with the appropriate options.\n>\n> I think 'log' is useful; it's more descriptive then having just a hash,\n> which is the default...\n>\n> > Perhaps you can shed some light on\n> > the use-cases these combinations support.\n> >\n> > I would think something like:\n> >\n> > git diff --stat --submodule-follow\n> > git diff --stat --submodule-follow-depth=4\n> >\n> > git diff --names-only --submodule-follow\n> > git diff --dirstat --submodule-follow\n> > and for other commands (some sort of header line should be printed to\n> > note the history is under the submodule X):\n> >\n> > git log --submodule-follow\n> > git log --submodule-follow-depth=4\n> >\n> > and of course allowing `--` modifier:\n> >\n> > git log --submodule-follow -- libs/library1\n> >\n> > would be easier to use.\n>\n> I'm not sure of the use case for these... The history\n> of the submodule project can be seen with `git -C path/to/submodule log`\n> (or just `cd` there and `git log`), and the history of the gitlink in the superproject\n> with `git log -- path/to/submodule`...\n>\n> It does not really make sense to interleave the history of the superproject and\n> the submodule in the same output, in my opinion at least.\n>\n> > Let me know if any of this resonates, and if some patches along these\n> > lines would be welcomed\n>\n> I can't really answer that, I'm just a small time contributor :)\n\nI will wait for some thoughts on the proposal, and to see if someone\ncan shed some light on the reasons why `--submodule=` option works the\nway it does, today, in git diff.\n\nRegards\nmarc\n\n>\n> > (might ask some help offlist).\n>\n> You should ask on the list, on the mentoring list, or on IRC (see [1]).\n>\n> [1] https://git-scm.com/docs/MyFirstContribution#getting-help\n>\n> Cheers,\n> Philippe.\n>\n"}]}