git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: rev-list --cherry-pick and context lines

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 2, 2011, 19:13 UTC
Message-ID
<7vippalpuj.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1k6zcbk.ov5qevxc1a91M%lists@haller-berlin.de>
lists@haller-berlin.de (Stefan Haller) writes:
> Is there a reason why the hard-coded default is 3 in the current code?
> It seems to me that 1 would be a better choice; it would mean "patches
> are equal if their added/removed lines are the same, and they could be
> cherry-picked without conflicts."

Even if two patches have the same added/deleted lines, depending on where in the preimage they are applied (which is given by the context lines), the meaning of the patches can be and are very different. So if the default for showing uses 3-line contect (hence applying, as e-mailed patches are usually generated with 3-line context), it makes sense for the default to generate patch id to match it.

As Michael hinted, I think it would make sense to reduce the number of context lines to generate patch-id the same way if/when you reduce the context to smaller number of lines for the purpose of patch application, but it does not make sense to use zero-line context as default.

Previous: Stefan Haller
Message 6 of 6 in “rev-list --cherry-pick and context lines”
  1. Stefan HallerSep 2, 2011
  2. Michael J GruberSep 2, 2011
  3. Stefan HallerSep 2, 2011
  4. Vijay LakshminarayananSep 2, 2011
  5. Stefan HallerSep 2, 2011
  6. Junio C HamanoSep 2, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.