{"thread":{"id":"22511","subject":"Using \"git log\" to find the files patched at the same time as a named file","startedAt":"2010-02-03T20:38:03Z","lastAt":"2010-02-03T21:52:36Z","messageCount":5,"participants":["Zack Brown","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"133525","messageId":"218b69371002031238y6a377b06x76b8f8e87ea0ee46@mail.gmail.com","threadId":"22511","inReplyTo":null,"subject":"Using \"git log\" to find the files patched at the same time as a named file","fromName":"Zack Brown","fromEmail":"zacharyb@gmail.com","sentAt":"2010-02-03T20:38:03Z","receivedAt":"2010-02-03T20:38:03Z","isPatch":false,"sender":{"key":"zacharyb@gmail.com","avatar":"https://gravatar.com/avatar/d01e954365eae00957bcf8c5f1a9757cbaddf0f3d5229ace9b2ac84c498e40c0?d=mp&s=160"},"body":"Hi folks,\n\nIf I have a filename I'm interested in, and I want to find other files\nthat have been modified in the same commits that modified the file I'm\ninterested in, how could I do that with git?\n\nIf I give the command\n$ git log --name-only\nthen the bottom of each log entry will list all the files that were\nmodified by that commit. That's basically what I want, except that the\ncommand will list all log entries, not just the ones that modified the\nfile I'm interested in.\n\nIf I give the command\n$ git log --name-only fs/fuse/file.c\nthen the bottom of each log entry only lists fs/fuse/file.c, even if\nthe very same commit showed up in the output from the previous command\nwith multiple files in addition to that one. In other words, the \"git\nlog --name-only fs/fuse/file.c\" command will only list fs/fuse/file.c\nas being changed, in commits that I know changed more than just that\none file.\n\nIs there a git command that will run in roughly the same amount of\ntime as the ones given above (i.e. with only a single invocation of\ngit), but that will only output the commits that affected the file I'm\ninterested in, and that will also list any other files changed in\nthose same commits?\n\nMany thanks,\nZack\n\n-- \nZack Brown\n"},{"id":"133530","messageId":"7vk4uughzf.fsf@alter.siamese.dyndns.org","threadId":"22511","inReplyTo":"218b69371002031238y6a377b06x76b8f8e87ea0ee46@mail.gmail.com","subject":"Re: Using \"git log\" to find the files patched at the same time as a named file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-03T20:52:04Z","receivedAt":"2010-02-03T20:52:04Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Zack Brown <zacharyb@gmail.com> writes:\n\n> If I have a filename I'm interested in, and I want to find other files\n> that have been modified in the same commits that modified the file I'm\n> interested in, how could I do that with git?\n\nLike this?\n\n$ git log --full-diff --name-status v1.6.0..master -- Makefile\n\nto ask \"Which files have changed in the commit that touch Makefile since\nv1.6.0 up to the tip of the master?\"\n"},{"id":"133537","messageId":"218b69371002031314rb52da81k92c45f79dc6feca@mail.gmail.com","threadId":"22511","inReplyTo":"7vk4uughzf.fsf@alter.siamese.dyndns.org","subject":"Re: Using \"git log\" to find the files patched at the same time as a named file","fromName":"Zack Brown","fromEmail":"zacharyb@gmail.com","sentAt":"2010-02-03T21:14:02Z","receivedAt":"2010-02-03T21:14:02Z","isPatch":false,"sender":{"key":"zacharyb@gmail.com","avatar":"https://gravatar.com/avatar/d01e954365eae00957bcf8c5f1a9757cbaddf0f3d5229ace9b2ac84c498e40c0?d=mp&s=160"},"body":"On Wed, Feb 3, 2010 at 3:52 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Zack Brown <zacharyb@gmail.com> writes:\n>\n>> If I have a filename I'm interested in, and I want to find other files\n>> that have been modified in the same commits that modified the file I'm\n>> interested in, how could I do that with git?\n>\n> Like this?\n>\n> $ git log --full-diff --name-status v1.6.0..master -- Makefile\n\nYes! Thank you!\n\nI went back to the man page to see why I didn't find that before.\nHere's the text for the --full-diff option:\n\n   \"Without this flag, \"git log -p <path>...\" shows commits that touch\n   the specified paths, and diffs about the same specified paths. With\n   this, the full diff is shown for commits that touch the specified\n   paths; this means that \"<path>...\" limits only commits, and doesn’t\n   limit diff for those commits.\"\n\nThat's all the text that deals with --full-diff in the git log\nmanpage. I'm not sure what it's trying to say - it seems really hard\nto understand. What about something like this:\n\n\"Without this flag, \"git log -p <path>...\" shows commits that touch\nthe specified paths, but it only includes the diffs from those commits\nthat affected those specified paths, regardless of whether other paths\nwere changed in those same commits. With \"git log --full-diff -p\n<path>...\", git still only reports commits that touch the specified\npath, but now it also includes the diffs that affected any other paths\nchanged in those same commits.\"\n\nWould that be an improvement?\n\nBe well,\nZack\n\n>\n> to ask \"Which files have changed in the commit that touch Makefile since\n> v1.6.0 up to the tip of the master?\"\n>\n\n\n\n-- \nZack Brown\n"},{"id":"133539","messageId":"7vfx5idmt2.fsf@alter.siamese.dyndns.org","threadId":"22511","inReplyTo":"218b69371002031314rb52da81k92c45f79dc6feca@mail.gmail.com","subject":"Re: Using \"git log\" to find the files patched at the same time as a named file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-03T21:36:09Z","receivedAt":"2010-02-03T21:36:09Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Zack Brown <zacharyb@gmail.com> writes:\n\n> ... What about something like this:\n>\n> \"Without this flag, \"git log -p <path>...\" shows commits that touch\n> the specified paths, but it only includes the diffs from those commits\n\nI would say \"s/but/and/\", because it is more natural that you get the\n\"limited\" view after you explicitly stated that you are \"only interested\nin these things\" by giving pathspecs.\n\n> that affected those specified paths, regardless of whether other paths\n> were changed in those same commits. With \"git log --full-diff -p\n> <path>...\", git still only reports commits that touch the specified\n> path, but now it also includes the diffs that affected any other paths\n> changed in those same commits.\"\n\nAnd \"but\" on the second line from the bottom makes sense---by giving the\noption, you are telling it to work differently.\n\n> Would that be an improvement?\n\nSurely.  I would suspect that people would go even further.  \"-p\" is not\nvery special (notice I used --name-status in my example).\n\nAlso I think the description should start with what it _does_, not with\nwhat happens without it.\n\nSo how about this?\n\ndiff --git a/Documentation/git-log.txt b/Documentation/git-log.txt\nindex 0e39bb6..5dd1c0c 100644\n--- a/Documentation/git-log.txt\n+++ b/Documentation/git-log.txt\n@@ -49,11 +49,14 @@ include::diff-options.txt[]\n \tcommit was reached.\n \n --full-diff::\n-\tWithout this flag, \"git log -p <path>...\" shows commits that\n-\ttouch the specified paths, and diffs about the same specified\n-\tpaths.  With this, the full diff is shown for commits that touch\n-\tthe specified paths; this means that \"<path>...\" limits only\n-\tcommits, and doesn't limit diff for those commits.\n+\tShow all changes, even outside the given pathspecs.\n++\n+Pathspecs <path>... given to \"git log [<options>] <path>...\"  limit the\n+output to the commits that touch the specified paths.  When options to\n+show changes introduced by these commits (e.g. \"-p\", \"--name-only\") are\n+given, the output of the changes are also limited to the specified paths.\n+This option lifts the latter limit and tells \"git log\" to include all\n+changes, even the ones outside of the given pathspecs.\n \n --follow::\n \tContinue listing the history of a file beyond renames.\n"},{"id":"133542","messageId":"218b69371002031352je066f5cvd87025459fade368@mail.gmail.com","threadId":"22511","inReplyTo":"7vfx5idmt2.fsf@alter.siamese.dyndns.org","subject":"Re: Using \"git log\" to find the files patched at the same time as a named file","fromName":"Zack Brown","fromEmail":"zacharyb@gmail.com","sentAt":"2010-02-03T21:52:36Z","receivedAt":"2010-02-03T21:52:36Z","isPatch":false,"sender":{"key":"zacharyb@gmail.com","avatar":"https://gravatar.com/avatar/d01e954365eae00957bcf8c5f1a9757cbaddf0f3d5229ace9b2ac84c498e40c0?d=mp&s=160"},"body":"That looks much clearer. But I would change the final sentence to,\n\"This option lifts that limit and tells \"git log\" to include changes\nfrom all paths that were affected by the outputted commits, not just\nthe changes from the paths specified on the command line.\"\n\nBe well,\nZack\n\nOn Wed, Feb 3, 2010 at 4:36 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Zack Brown <zacharyb@gmail.com> writes:\n>\n>> ... What about something like this:\n>>\n>> \"Without this flag, \"git log -p <path>...\" shows commits that touch\n>> the specified paths, but it only includes the diffs from those commits\n>\n> I would say \"s/but/and/\", because it is more natural that you get the\n> \"limited\" view after you explicitly stated that you are \"only interested\n> in these things\" by giving pathspecs.\n>\n>> that affected those specified paths, regardless of whether other paths\n>> were changed in those same commits. With \"git log --full-diff -p\n>> <path>...\", git still only reports commits that touch the specified\n>> path, but now it also includes the diffs that affected any other paths\n>> changed in those same commits.\"\n>\n> And \"but\" on the second line from the bottom makes sense---by giving the\n> option, you are telling it to work differently.\n>\n>> Would that be an improvement?\n>\n> Surely.  I would suspect that people would go even further.  \"-p\" is not\n> very special (notice I used --name-status in my example).\n>\n> Also I think the description should start with what it _does_, not with\n> what happens without it.\n>\n> So how about this?\n>\n> diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt\n> index 0e39bb6..5dd1c0c 100644\n> --- a/Documentation/git-log.txt\n> +++ b/Documentation/git-log.txt\n> @@ -49,11 +49,14 @@ include::diff-options.txt[]\n>        commit was reached.\n>\n>  --full-diff::\n> -       Without this flag, \"git log -p <path>...\" shows commits that\n> -       touch the specified paths, and diffs about the same specified\n> -       paths.  With this, the full diff is shown for commits that touch\n> -       the specified paths; this means that \"<path>...\" limits only\n> -       commits, and doesn't limit diff for those commits.\n> +       Show all changes, even outside the given pathspecs.\n> ++\n> +Pathspecs <path>... given to \"git log [<options>] <path>...\"  limit the\n> +output to the commits that touch the specified paths.  When options to\n> +show changes introduced by these commits (e.g. \"-p\", \"--name-only\") are\n> +given, the output of the changes are also limited to the specified paths.\n> +This option lifts the latter limit and tells \"git log\" to include all\n> +changes, even the ones outside of the given pathspecs.\n>\n>  --follow::\n>        Continue listing the history of a file beyond renames.\n>\n>\n>\n\n\n\n-- \nZack Brown\n"}]}