{"thread":{"id":"26812","subject":"cherry-pick applies some other changes than the specified one?","startedAt":"2011-03-21T09:27:52Z","lastAt":"2011-03-22T08:04:34Z","messageCount":13,"participants":["Piotr Krukowiecki","Junio C Hamano","Johannes Sixt","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"163878","messageId":"AANLkTikE5AqJyShN+GfFYe0kBS=ShGnKQcnwbarNZrjm@mail.gmail.com","threadId":"26812","inReplyTo":null,"subject":"cherry-pick applies some other changes than the specified one?","fromName":"Piotr Krukowiecki","fromEmail":"piotr.krukowiecki@gmail.com","sentAt":"2011-03-21T09:27:52Z","receivedAt":"2011-03-21T09:27:52Z","isPatch":false,"sender":{"key":"piotr.krukowiecki@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3259959?v=4"},"body":"Hi,\n\nI'm cherry-picking one commint between branches. The commit is a simple\none-line addition, something like:\n\n--- a/etc/file\n+++ b/etc/file\n@@ -2613,6 +2613,7 @@\nline1\nline2\n+   line3\nline4\nline5\n\n\nThere's a conflict during the cherry-pick. git status shows:\n\n$ git status\n# On branch 9_0\n# Unmerged paths:\n#   (use \"git add/rm <file>...\" as appropriate to mark resolution)\n#\n#\tboth modified:      etc/file\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\ngit diff shows a lot of changes:\n\ndiff --cc etc/file\nindex 815c28f,b8a48da..0000000\n--- a/etc/file\n+++ b/etc/file\n@@@ -2700,83 -2611,10 +2700,89 @@@\n[...]\n++<<<<<<< HEAD\n +    line\n +    line\n[...]\n++=======\n+     here I basically can see what's code\n+     look like in the commit I want to merge\n++>>>>>>> c64e8ca...\n       line\n +    line\n[...]\n\n\nIf I edit the file and remove the \"<<<< HEAD\" marked and code\nbetween \"===\" and \">>>\"  then\n\n1. git status shows there are unmerged files:\n\n$ git status\n# On branch 9_0\n# Unmerged paths:\n#   (use \"git add/rm <file>...\" as appropriate to mark resolution)\n#\n#\tboth modified:      etc/file\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n2. git diff shows nothing:\n\n$ git diff\ndiff --cc etc/file\nindex 815c28f,b8a48da..0000000\n--- a/etc/file\n+++ b/etc/file\n\n3. git diff --cached shows error? warning? info?\n\n$ git diff --cached\n* Unmerged path etc/file\n\n4. When I git add the file then git status, git diff, git diff\n--cached shows nothing:\n\n$ git add etc/file\n$ git status\n# On branch 9_0\nnothing to commit (working directory clean)\n$ git diff\n$ git diff --cached\n\n\nBut when I take a different approach, and in addition to this:\n\n> If I edit the file and remove the \"<<<< HEAD\" marked and code\n> between \"===\" and \">>>\"  then\n\nI also manually add the \"+line\" which is the change done in the cherry-picked\ncommit, git diff shows a lot of other changes in unrelated lines\n(which lie close\nbut still were not modified by the patch, nor were shown previously by\ngit diff).\n\n\nThis is very weird. I understand the information I provided was very scarce,\nbut does anyone know what could be happening?\nOr do I have to try to reproduce this behaviour and post the steps to do so?\n\nIt might be somehow related to git-svn or git-new-workdir ...\n\n-- \nPiotr Krukowiecki\n"},{"id":"163919","messageId":"7vwrjssbfk.fsf@alter.siamese.dyndns.org","threadId":"26812","inReplyTo":"AANLkTikE5AqJyShN+GfFYe0kBS=ShGnKQcnwbarNZrjm@mail.gmail.com","subject":"Re: cherry-pick applies some other changes than the specified one?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-03-21T16:09:03Z","receivedAt":"2011-03-21T16:09:03Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:\n\n> There's a conflict during the cherry-pick. git status shows:\n>\n> $ git status\n> # On branch 9_0\n> # Unmerged paths:\n> #   (use \"git add/rm <file>...\" as appropriate to mark resolution)\n> #\n> #\tboth modified:      etc/file\n> #\n> no changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nCorrect.  The commit you are applying the change with cherry-pick has\netc/file different from the parent of the commit being cherry-picked, and\nthe commit being cherry-picked also has it different, hence \"both\nmodified\".\n\n> git diff shows a lot of changes:\n> ...\n\nAgain correct; it is showing the mechanical (half)merge result so that you\nknow where you had overlapping changes.  The comparison between an\nunmerged index and the working tree shows the changes in the file in the\nworking tree with respect to both versions (the one in the commit you are\non, and the other one in the commit you are cherry-picking), omitting\nparts that the file in the working tree match one of the versions.  This\nis how you don't have to see any part of the file that was trivially\nmerged in the output.\n\n> If I edit the file and remove the \"<<<< HEAD\" marked and code\n> between \"===\" and \">>>\"  then\n>\n> 1. git status shows there are unmerged files:\n>\n> $ git status\n> # On branch 9_0\n> # Unmerged paths:\n> #   (use \"git add/rm <file>...\" as appropriate to mark resolution)\n> #\n> #\tboth modified:      etc/file\n> #\n> no changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nCorrect; until you \"git add\" to mark the conflict resolved, the path is\nunmerged (do not ignore instructions in parentheses).\n\n> 2. git diff shows nothing:\n>\n> $ git diff\n> diff --cc etc/file\n> index 815c28f,b8a48da..0000000\n> --- a/etc/file\n> +++ b/etc/file\n\nAgain, correct.  Read the description above on the \"git diff\" output.  At\nthis point, you removed the parts that came from one side (cherry-picked\nside) by removing the lines between \"===\" and \">>>\", so the lines in the\nfile in the working tree around that place match the other side (the one\nin the commit you are on).  There is no block of lines that do not match\none of the sides, so there is no combined diff to show.\n\n> 3. git diff --cached shows error? warning? info?\n>\n> $ git diff --cached\n> * Unmerged path etc/file\n\nCorrect.  It is showing that you haven't run \"git add\" to resolve the\npath, so it still is unmerged.\n\n> 4. When I git add the file then git status, git diff, git diff\n> --cached shows nothing:\n\nCorrect.  \"git diff\" is about comparing between the version in the index\nyou recorded with \"git add\" and the file in the working tree, so there is\nnothing to show.  \"git diff --cached [HEAD]\" compares the index and the\nHEAD, and it is understandable the result in the index matches HEAD if you\ndiscarded what came from the cherry-pick before step 1.\n\n> But when I take a different approach, and in addition to this:\n>\n>> If I edit the file and remove the \"<<<< HEAD\" marked and code\n>> between \"===\" and \">>>\"  then\n>\n> I also manually add the \"+line\" which is the change done in the cherry-picked\n> commit, git diff shows a lot of other changes in unrelated lines\n> (which lie close\n> but still were not modified by the patch, nor were shown previously by\n> git diff).\n>\n> This is very weird.\n\nSorry, I have no idea what you are talking about.\n"},{"id":"163923","messageId":"4D877FAD.9000807@viscovery.net","threadId":"26812","inReplyTo":"7vwrjssbfk.fsf@alter.siamese.dyndns.org","subject":"Re: cherry-pick applies some other changes than the specified one?","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2011-03-21T16:41:17Z","receivedAt":"2011-03-21T16:41:17Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 3/21/2011 17:09, schrieb Junio C Hamano:\n> Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:\n>> But when I take a different approach, and in addition to this:\n>>\n>>> If I edit the file and remove the \"<<<< HEAD\" marked and code\n>>> between \"===\" and \">>>\"  then\n>>\n>> I also manually add the \"+line\" which is the change done in the cherry-picked\n>> commit, git diff shows a lot of other changes in unrelated lines\n>> (which lie close\n>> but still were not modified by the patch, nor were shown previously by\n>> git diff).\n>>\n>> This is very weird.\n> \n> Sorry, I have no idea what you are talking about.\n\nAssuming you did not 'git add' the file yet, you are looking at the\n\"condensed combined diff\" after manually resolving the conflict by doing\nthe \"+line\" manually that the cherry-pick should have brought in. Of\ncourse, a lot of context is visible here if both sides have diverged\nconsiderably in this area.\n\nI.e. the diff will look something like\n\n +line from HEAD\n +line from HEAD\n+ line from cherry-picked\n +line from HEAD\n...\n\nNotice the double columns before the content lines. This sort of diff\nextens above and below the conflicting section until there is a \"gap\" of 3\nlines that changed neither on the HEAD side nor on the cherry-picked side\nsince the merge base.\n\n-- Hannes\n"},{"id":"163935","messageId":"4D879516.3060204@gmail.com","threadId":"26812","inReplyTo":"4D877FAD.9000807@viscovery.net","subject":"Re: cherry-pick applies some other changes than the specified one?","fromName":"Piotr Krukowiecki","fromEmail":"piotr.krukowiecki@gmail.com","sentAt":"2011-03-21T18:12:38Z","receivedAt":"2011-03-21T18:12:38Z","isPatch":false,"sender":{"key":"piotr.krukowiecki@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3259959?v=4"},"body":"W dniu 21.03.2011 17:41, Johannes Sixt pisze:\n> Am 3/21/2011 17:09, schrieb Junio C Hamano:\n>> Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:\n>>> But when I take a different approach, and in addition to this:\n>>>\n>>>> If I edit the file and remove the \"<<<< HEAD\" marked and code\n>>>> between \"===\" and \">>>\"  then\n>>>\n>>> I also manually add the \"+line\" which is the change done in the cherry-picked\n>>> commit, git diff shows a lot of other changes in unrelated lines\n>>> (which lie close\n>>> but still were not modified by the patch, nor were shown previously by\n>>> git diff).\n>>>\n>>> This is very weird.\n>>\n>> Sorry, I have no idea what you are talking about.\n\nI hoped someone might have some clues :)\n\n \n> Assuming you did not 'git add' the file yet, you are looking at the\n> \"condensed combined diff\" after manually resolving the conflict by doing\n> the \"+line\" manually that the cherry-pick should have brought in. Of\n> course, a lot of context is visible here if both sides have diverged\n> considerably in this area.\n> \n> I.e. the diff will look something like\n> \n>  +line from HEAD\n>  +line from HEAD\n> + line from cherry-picked\n>  +line from HEAD\n> ...\n> \n> Notice the double columns before the content lines. This sort of diff\n> extens above and below the conflicting section until there is a \"gap\" of 3\n> lines that changed neither on the HEAD side nor on the cherry-picked side\n> since the merge base.\n\nHm that might be possible! I'll check it tomorrow @work.\n\nIf that's the case here is what got me lost:\n\nAs I wrote earlier, after removing the \"<<<< HEAD\" and code between \"===\" \nand \">>>\", the git-diff showed nothing. So the natural impression was\n\"my files does not have any changes in working tree\".\n\nBut then when I have added one line and did the diff again, it suddenly\nstarted showing some other changes, unrelated to the added line or to\nthe cherry-picked commit.\n \nI might have misses the double columns in the diff output so I though\nit's just normal diff.\n\nThanks to your and Junio explanation I now understand why it works like\nthat.\n\nI think I even suspected this might have something to do with the merge\nconflict and tried to make git-diff show me exact change between working\ntree and index/HEAD (ignoring the merge), so I can verify the file indeed\nonly have the change I did, but I could not find such option.\nDoes it exists? \n\n\n-- \nPiotr Krukowiecki\n"},{"id":"163964","messageId":"7vei60p86y.fsf@alter.siamese.dyndns.org","threadId":"26812","inReplyTo":"4D879516.3060204@gmail.com","subject":"Re: cherry-pick applies some other changes than the specified one?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-03-21T19:47:17Z","receivedAt":"2011-03-21T19:47:17Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:\n\n> I think I even suspected this might have something to do with the merge\n> conflict and tried to make git-diff show me exact change between working\n> tree and index/HEAD (ignoring the merge).\n\nDoesn't \"git diff HEAD\" show the difference between HEAD and working tree\nwithout the higher stages for the path getting in the way?\n\nThe difference between the index and the working tree is \"git diff\" which\nis condensed.  I think you can force it to uncondense it by giving \"-c\"\noption, but I haven't tried (didn't find a need/use for it for a long\ntime).\n"},{"id":"163969","messageId":"20110321195846.GA4277@elie","threadId":"26812","inReplyTo":"4D879516.3060204@gmail.com","subject":"Re: cherry-pick applies some other changes than the specified one?","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-03-21T19:58:46Z","receivedAt":"2011-03-21T19:58:46Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Piotr Krukowiecki wrote:\n\n> I think I even suspected this might have something to do with the merge\n> conflict and tried to make git-diff show me exact change between working\n> tree and index/HEAD (ignoring the merge), so I can verify the file indeed\n> only have the change I did, but I could not find such option.\n> Does it exists? \n\nSure.  The index contains multiple competing versions, which you can\nsee with \"git ls-files -u\".  To compare the working tree and one of\nthose use \"git diff --base / --ours / --theirs\" (or -1 / -2 / -3).\n\nTo view changes relative to a particular commit, use \"git diff <commit>\".\nFor example, \"git diff HEAD\".  The git-diff(1) manpage (shown by\n\"git diff --help\") explains.\n\nHope that helps,\nJonathan\n"},{"id":"163972","messageId":"4D87AFB2.8080904@gmail.com","threadId":"26812","inReplyTo":"7vei60p86y.fsf@alter.siamese.dyndns.org","subject":"Re: cherry-pick applies some other changes than the specified one?","fromName":"Piotr Krukowiecki","fromEmail":"piotr.krukowiecki@gmail.com","sentAt":"2011-03-21T20:06:10Z","receivedAt":"2011-03-21T20:06:10Z","isPatch":false,"sender":{"key":"piotr.krukowiecki@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3259959?v=4"},"body":"W dniu 21.03.2011 20:47, Junio C Hamano pisze:\n> Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:\n> \n>> I think I even suspected this might have something to do with the merge\n>> conflict and tried to make git-diff show me exact change between working\n>> tree and index/HEAD (ignoring the merge).\n> \n> Doesn't \"git diff HEAD\" show the difference between HEAD and working tree\n> without the higher stages for the path getting in the way?\n\nForgot about this - usually commit defaults to HEAD if you didn't specify it.\nMy fault.\n\n \n> The difference between the index and the working tree is \"git diff\" which\n> is condensed.  I think you can force it to uncondense it by giving \"-c\"\n> option, but I haven't tried (didn't find a need/use for it for a long\n> time).\n\nI think I tried it and it didn't work. It's also not described in git diff\nman page.\n\n\n-- \nPiotr Krukowiecki\n"},{"id":"163973","messageId":"4D87B00D.2010905@gmail.com","threadId":"26812","inReplyTo":"20110321195846.GA4277@elie","subject":"Re: cherry-pick applies some other changes than the specified one?","fromName":"Piotr Krukowiecki","fromEmail":"piotr.krukowiecki@gmail.com","sentAt":"2011-03-21T20:07:41Z","receivedAt":"2011-03-21T20:07:41Z","isPatch":false,"sender":{"key":"piotr.krukowiecki@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3259959?v=4"},"body":"W dniu 21.03.2011 20:58, Jonathan Nieder pisze:\n> Piotr Krukowiecki wrote:\n> \n>> I think I even suspected this might have something to do with the merge\n>> conflict and tried to make git-diff show me exact change between working\n>> tree and index/HEAD (ignoring the merge), so I can verify the file indeed\n>> only have the change I did, but I could not find such option.\n>> Does it exists? \n> \n> Sure.  The index contains multiple competing versions, which you can\n> see with \"git ls-files -u\".  To compare the working tree and one of\n> those use \"git diff --base / --ours / --theirs\" (or -1 / -2 / -3).\n\nThanks, didn't know about that (and it's not documented in diff man page).\n\n \n> To view changes relative to a particular commit, use \"git diff <commit>\".\n> For example, \"git diff HEAD\".  The git-diff(1) manpage (shown by\n> \"git diff --help\") explains.\n> \n> Hope that helps,\n> Jonathan\n\n\n-- \nPiotr Krukowiecki\n"},{"id":"163974","messageId":"7v62rcp6m6.fsf@alter.siamese.dyndns.org","threadId":"26812","inReplyTo":"4D87B00D.2010905@gmail.com","subject":"Re: cherry-pick applies some other changes than the specified one?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-03-21T20:21:21Z","receivedAt":"2011-03-21T20:21:21Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:\n\n>> Sure.  The index contains multiple competing versions, which you can\n>> see with \"git ls-files -u\".  To compare the working tree and one of\n>> those use \"git diff --base / --ours / --theirs\" (or -1 / -2 / -3).\n>\n> Thanks, didn't know about that (and it's not documented in diff man page).\n\nThese \"compare a particular stage against working tree file\" modes\nonly make sense when you are comparing the index and the working tree, so\nthe description is in \"git diff-files\" manpage but hasn't been ported to\nthe documentation of generic \"git diff\" frontend.\n\nPerhaps we should.\n"},{"id":"163983","messageId":"7vsjugnqig.fsf@alter.siamese.dyndns.org","threadId":"26812","inReplyTo":"7v62rcp6m6.fsf@alter.siamese.dyndns.org","subject":"Re: cherry-pick applies some other changes than the specified one?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-03-21T20:54:31Z","receivedAt":"2011-03-21T20:54:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>> Thanks, didn't know about that (and it's not documented in diff man page).\n>\n> These \"compare a particular stage against working tree file\" modes\n> only make sense when you are comparing the index and the working tree, so\n> the description is in \"git diff-files\" manpage but hasn't been ported to\n> the documentation of generic \"git diff\" frontend.\n>\n> Perhaps we should.\n\nAnd here is a quick attempt to do so.\n\nThis just leaves the details of what -c/--cc are about to the combined\ndiff format section in diff-generate-patch.txt, which I updated in the\nseparate patch.\n\n Documentation/diff-options.txt   |   31 +++++++++++++++++++++++++++++++\n Documentation/git-diff-files.txt |   19 -------------------\n Documentation/git-diff-tree.txt  |   20 --------------------\n 3 files changed, 31 insertions(+), 39 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex c93124b..19ce302 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -24,6 +24,37 @@ ifndef::git-format-patch[]\n --patch::\n \tGenerate patch (see section on generating patches).\n \t{git-diff? This is the default.}\n+\n+-1 --base::\n+-2 --ours::\n+-3 --theirs::\n+-0::\n+\tThese make sense only when comparing the index and the working\n+\ttree (i.e. `git diff-files` or `git diff <path>...`) and compares\n+\tagainst the \"base\" version, \"our branch\" or \"their\n+\tbranch\" respectively.  With these options, diffs for\n+\tmerged entries are not shown.\n++\n+The default is to diff against our branch (-2) and the\n+cleanly resolved paths.  The option -0 can be given to\n+omit diff output for unmerged entries and just show \"Unmerged\".\n+\n+-c::\n+--cc::\n+\tProduce \"combined diff\" (and \"dense combined diff\" showing how the\n+\tresult is different compared to more than one original.\n++\n+When used in showing a merge commit (i.e. `git show <merge>`, \n+`git diff-tree <merge>` or when feeding a merge commit\n+to `git diff-tree --stdin`), compare the parent commits of the\n+merge with the merge commit.\n++\n+When used in comparison between the index and the working tree\n+(i.e. `git diff` during a conflicted merge or rebase),\n+compare stage 2 (our branch), stage 3 (their\n+branch) and the working tree file and outputs a combined\n+diff.\n+\n endif::git-format-patch[]\n \n -U<n>::\ndiff --git a/Documentation/git-diff-files.txt b/Documentation/git-diff-files.txt\nindex 8d48194..82d2e2e 100644\n--- a/Documentation/git-diff-files.txt\n+++ b/Documentation/git-diff-files.txt\n@@ -21,25 +21,6 @@ OPTIONS\n -------\n include::diff-options.txt[]\n \n--1 --base::\n--2 --ours::\n--3 --theirs::\n--0::\n-\tDiff against the \"base\" version, \"our branch\" or \"their\n-\tbranch\" respectively.  With these options, diffs for\n-\tmerged entries are not shown.\n-+\n-The default is to diff against our branch (-2) and the\n-cleanly resolved paths.  The option -0 can be given to\n-omit diff output for unmerged entries and just show \"Unmerged\".\n-\n--c::\n---cc::\n-\tThis compares stage 2 (our branch), stage 3 (their\n-\tbranch) and the working tree file and outputs a combined\n-\tdiff, similar to the way 'diff-tree' shows a merge\n-\tcommit with these flags.\n-\n -q::\n \tRemain silent even on nonexistent files\n \ndiff --git a/Documentation/git-diff-tree.txt b/Documentation/git-diff-tree.txt\nindex 4e5f127..ebcfcfb 100644\n--- a/Documentation/git-diff-tree.txt\n+++ b/Documentation/git-diff-tree.txt\n@@ -88,26 +88,6 @@ include::pretty-options.txt[]\n \t'git diff-tree' outputs a line with the commit ID when\n \tapplicable.  This flag suppressed the commit ID output.\n \n--c::\n-\tThis flag changes the way a merge commit is displayed\n-\t(which means it is useful only when the command is given\n-\tone <tree-ish>, or '--stdin').  It shows the differences\n-\tfrom each of the parents to the merge result simultaneously\n-\tinstead of showing pairwise diff between a parent and the\n-\tresult one at a time (which is what the '-m' option does).\n-\tFurthermore, it lists only files which were modified\n-\tfrom all parents.\n-\n---cc::\n-\tThis flag changes the way a merge commit patch is displayed,\n-\tin a similar way to the '-c' option. It implies the '-c'\n-\tand '-p' options and further compresses the patch output\n-\tby omitting uninteresting hunks whose the contents in the parents\n-\thave only two variants and the merge result picks one of them\n-\twithout modification.  When all hunks are uninteresting, the commit\n-\titself and the commit log message is not shown, just like in any other\n-\t\"empty diff\" case.\n-\n --always::\n \tShow the commit itself and the commit log message even\n \tif the diff itself is empty.\n"},{"id":"164013","messageId":"20110322052742.GA7637@elie","threadId":"26812","inReplyTo":"7vsjugnqig.fsf@alter.siamese.dyndns.org","subject":"Re: cherry-pick applies some other changes than the specified one?","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-03-22T05:27:43Z","receivedAt":"2011-03-22T05:27:43Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> This just leaves the details of what -c/--cc are about to the combined\n> diff format section in diff-generate-patch.txt, which I updated in the\n> separate patch.\n\nThanks; this looks pretty good.  A few nitpicks:\n\n> --- a/Documentation/diff-options.txt\n> +++ b/Documentation/diff-options.txt\n> @@ -24,6 +24,37 @@ ifndef::git-format-patch[]\n>  --patch::\n>  \tGenerate patch (see section on generating patches).\n>  \t{git-diff? This is the default.}\n> +\n> +-1 --base::\n> +-2 --ours::\n> +-3 --theirs::\n> +-0::\n> +\tThese make sense only when comparing the index and the working\n> +\ttree (i.e. `git diff-files` or `git diff <path>...`) and compares\n> +\tagainst the \"base\" version, \"our branch\" or \"their\n> +\tbranch\" respectively.  With these options, diffs for\n> +\tmerged entries are not shown.\n> ++\n> +The default is to diff against our branch (-2) and the\n> +cleanly resolved paths.  The option -0 can be given to\n> +omit diff output for unmerged entries and just show \"Unmerged\".\n\nI am not sure what this comment about the default means.  Isn't the\ndefault to use --cc?\n\n> +\n> +-c::\n> +--cc::\n> +\tProduce \"combined diff\" (and \"dense combined diff\" showing how the\n> +\tresult is different compared to more than one original.\n\nMissing an article after \"Produce\" (produce a combined diff) and a\nclosing parenthesis after \"dense combined diff\", I think.\n\nMore importantly, it might be nice to say\n\n\tSee the section \"diff format for merges\" of\n\tlinkgit:git-diff[1] for details.\n"},{"id":"164015","messageId":"7vlj07mzie.fsf@alter.siamese.dyndns.org","threadId":"26812","inReplyTo":"20110322052742.GA7637@elie","subject":"Re: cherry-pick applies some other changes than the specified one?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-03-22T06:37:45Z","receivedAt":"2011-03-22T06:37:45Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>> --- a/Documentation/diff-options.txt\n>> +++ b/Documentation/diff-options.txt\n>> @@ -24,6 +24,37 @@ ifndef::git-format-patch[]\n>>  --patch::\n>>  \tGenerate patch (see section on generating patches).\n>>  \t{git-diff? This is the default.}\n>> +\n>> +-1 --base::\n>> +-2 --ours::\n>> +-3 --theirs::\n>> +-0::\n>> +\tThese make sense only when comparing the index and the working\n>> +\ttree (i.e. `git diff-files` or `git diff <path>...`) and compares\n>> +\tagainst the \"base\" version, \"our branch\" or \"their\n>> +\tbranch\" respectively.  With these options, diffs for\n>> +\tmerged entries are not shown.\n>> ++\n>> +The default is to diff against our branch (-2) and the\n>> +cleanly resolved paths.  The option -0 can be given to\n>> +omit diff output for unmerged entries and just show \"Unmerged\".\n>\n> I am not sure what this comment about the default means.  Isn't the\n> default to use --cc?\n\nDepends on where this is included.  That passage originally came from\ndiff-files, for which \"-2 if exists otherwise -0\" has been the default.\nWhen included in \"diff\" (and perhaps \"show\"), --cc is used by default.\nSo we would need the \"ifdef::git-diff-files[]/endif::git-diff-files[]\"\naround it.\n\n>> +\n>> +-c::\n>> +--cc::\n>> +\tProduce \"combined diff\" (and \"dense combined diff\" showing how the\n>> +\tresult is different compared to more than one original.\n\nSimilarly, we would need \"ifdef::defaults-to-cc[]/endif\" around a sentence\nhere to say that this is the default when showing unmerged entry.\n\n> Missing an article after \"Produce\" (produce a combined diff) and a\n> closing parenthesis after \"dense combined diff\", I think.\n>\n> More importantly, it might be nice to say\n>\n> \tSee the section \"diff format for merges\" of\n> \tlinkgit:git-diff[1] for details.\n\nThanks.\n"},{"id":"164020","messageId":"AANLkTimHEHQzV4B7beraEuT9Ta8+MBeyPPmSGkBWD+76@mail.gmail.com","threadId":"26812","inReplyTo":"4D879516.3060204@gmail.com","subject":"Re: cherry-pick applies some other changes than the specified one?","fromName":"Piotr Krukowiecki","fromEmail":"piotr.krukowiecki@gmail.com","sentAt":"2011-03-22T08:04:34Z","receivedAt":"2011-03-22T08:04:34Z","isPatch":false,"sender":{"key":"piotr.krukowiecki@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3259959?v=4"},"body":"On Mon, Mar 21, 2011 at 7:12 PM, Piotr Krukowiecki\n<piotr.krukowiecki@gmail.com> wrote:\n> W dniu 21.03.2011 17:41, Johannes Sixt pisze:\n>> Assuming you did not 'git add' the file yet, you are looking at the\n>> \"condensed combined diff\" after manually resolving the conflict by doing\n>> the \"+line\" manually that the cherry-pick should have brought in. Of\n>> course, a lot of context is visible here if both sides have diverged\n>> considerably in this area.\n>>\n>> I.e. the diff will look something like\n>>\n>>  +line from HEAD\n>>  +line from HEAD\n>> + line from cherry-picked\n>>  +line from HEAD\n>> ...\n>>\n>> Notice the double columns before the content lines. This sort of diff\n>> extens above and below the conflicting section until there is a \"gap\" of 3\n>> lines that changed neither on the HEAD side nor on the cherry-picked side\n>> since the merge base.\n>\n> Hm that might be possible! I'll check it tomorrow @work.\n\nYou were right - the line I've added manually have two \"++\", and the other\nlines shown with differences only have \"-\" and \"+\" in the second column.\n\nI'm still not clear what is exactly compared when I use plain diff or\n-c version.\nIt might be I need to read more docs. I'll ask if I'm still in doubt\nafter reading\nmore.\n\nThanks again for explaining this to me - saved me from a lot of PITA researching\n:)\n\n\n-- \nPiotr Krukowiecki\n"}]}