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

Re: diff weirdness (bug?)

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 14, 2014, 20:03 UTC
Message-ID
<xmqq8utdihqx.fsf@gitster.dls.corp.google.com>
In-Reply-To
<52FE6C64.4060700@gmail.com>
Dario Bertini <berdario@gmail.com> writes:
Show 36 quoted lines
> git clone git@github.com:ansible/ansible.git
> git revert 3616dffb68badb2b8d56
>
> manually solve the conflict (you can look at the commit here:
> https://github.com/ansible/ansible/commit/3616dffb68badb2b8d56ef34391d7aae8de79cd6
> )
>
> git diff will output:
>
> dario@macbook ~/P/ansible (devel*+|REVERTING)> git diff
> diff --cc lib/ansible/constants.py
> index c055ccf,6eac602..0000000
> --- a/lib/ansible/constants.py
> +++ b/lib/ansible/constants.py
> @@@ -84,16 -61,8 +84,12 @@@ active_user   = pwd.getpwuid(os.geteuid
>
>   # Needed so the RPM can call setup.py and have modules land in the
>   # correct location. See #1277 for discussion
> - if getattr(sys, "real_prefix", None):
> -     # in a virtualenv
> -     DIST_MODULE_PATH = os.path.join(sys.prefix, 'share/ansible/')
> - else:
> -     DIST_MODULE_PATH = '/usr/share/ansible/'
> + DIST_MODULE_PATH = os.path.join(sys.prefix, 'share/ansible/')
>
>  +# check all of these extensions when looking for yaml files for things
> like
>  +# group variables
>  +YAML_FILENAME_EXTENSIONS = [ "", ".yml", ".yaml" ]
>  +
>   # sections in config file
>   DEFAULTS='defaults'
>
>
>
> now, it weirdly/incorrectly says that we added the YAML-related lines

This is a combined diff, and yaml-related lines are added relative to your _other_ branch you are merging (notice these + are indented by one place). Relative to what you had at the tip of your branch before you started this operation that ended up conflicted, the half-merged result removes if/else that sets DIST_MODULE_PATH and replaces it with a single line (their +/- are on the first column, signifying that these are differences relative to the first parent, i.e. your state before you started the operation).

> if we remove these 3 lines, we'll get this diff:

With that understanding, I think the output after removing these three lines is perfectlyh understandable and correct. You are looking at the three lines that used to exist in the version you started from, that were missing from the other side. If you remoe them, it will show as removal from _your_ version (notice these - that shows what _you_ did manually are on the first column, saying that that is relative to _your_ version).

Previous: Dario BertiniNext: Dario Bertini
Message 2 of 5 in “diff weirdness (bug?)”
  1. Dario BertiniFeb 14, 2014
  2. Junio C HamanoFeb 14, 2014
  3. Dario BertiniFeb 16, 2014
  4. Thomas RastFeb 17, 2014
  5. Junio C HamanoFeb 18, 2014

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.