* diff weirdness (bug?)
@ 2014-02-14 19:20 Dario Bertini
2014-02-14 20:03 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Dario Bertini @ 2014-02-14 19:20 UTC (permalink / raw)
To: git
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
if we remove these 3 lines, we'll get this diff:
dario@macbook ~/P/ansible (devel*+|REVERTING)> git diff --patience
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,9 @@@ 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'
even more weirdly, it'll say that we deleted the yaml-related lines
if we also remove one of the extra blank lines next to the yaml lines we
get an empty diff:
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
running `git add .` and then checking with git diff --cached will show
that everything is normal
the output is the same also with
git diff --minimal
or
git diff --patience
--
xmpp: berdario@gmail.com
bitmessage: BM-2cTYXfGiSTsnx3righ6aHcJSWe4MV17jDP
gpg fingerprint: 3F8D53518012716C4EEF7DF67B498306B3BF75A0 (used just
for signing commits)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: diff weirdness (bug?)
2014-02-14 19:20 diff weirdness (bug?) Dario Bertini
@ 2014-02-14 20:03 ` Junio C Hamano
2014-02-16 23:31 ` Dario Bertini
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2014-02-14 20:03 UTC (permalink / raw)
To: Dario Bertini; +Cc: git
Dario Bertini <berdario@gmail.com> writes:
> 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).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: diff weirdness (bug?)
2014-02-14 20:03 ` Junio C Hamano
@ 2014-02-16 23:31 ` Dario Bertini
2014-02-17 10:20 ` Thomas Rast
2014-02-18 19:12 ` Junio C Hamano
0 siblings, 2 replies; 5+ messages in thread
From: Dario Bertini @ 2014-02-16 23:31 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On 02/14/2014 09:03 PM, Junio C Hamano wrote:
> 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).
>
Thank you, I was completely unaware of combined diffs. Still: I can't
see how this would explain the empty diff when deleting 4 lines instead
of 3.
Also: in the diff output I get 2 hashes, but these are not the hashes of
the commits, but the contents of the files apparently. One should be
HEAD (but if I run sha1sum over the file the hash doesn't match), but
the other can't be the commit which I reverted: the diff is too small...
or at least this is what I understand
By the way, in the man of git diff there's the briefly mentioned '-m'
flag. If anyone else reading this mail in the archives is confused by
the combined diff output, just use "git diff -m HEAD"... I'll probably
add this in my git aliases
--
xmpp: berdario@gmail.com
bitmessage: BM-2cTYXfGiSTsnx3righ6aHcJSWe4MV17jDP
gpg fingerprint: 3F8D53518012716C4EEF7DF67B498306B3BF75A0 (used just
for signing commits)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: diff weirdness (bug?)
2014-02-16 23:31 ` Dario Bertini
@ 2014-02-17 10:20 ` Thomas Rast
2014-02-18 19:12 ` Junio C Hamano
1 sibling, 0 replies; 5+ messages in thread
From: Thomas Rast @ 2014-02-17 10:20 UTC (permalink / raw)
To: Dario Bertini; +Cc: Junio C Hamano, git
Dario Bertini <berdario@gmail.com> writes:
> On 02/14/2014 09:03 PM, Junio C Hamano wrote:
>> 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).
>>
>
> Thank you, I was completely unaware of combined diffs. Still: I can't
> see how this would explain the empty diff when deleting 4 lines instead
> of 3.
With a --cc diff (which it is: it says 'diff --cc' in the file headers)
git doesn't show the combined diff for hunks that fully agree with one
side.
So if you (even manually) resolve the merge so that it fully matches one
side, that will not show up in a --cc diff.
--
Thomas Rast
tr@thomasrast.ch
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: diff weirdness (bug?)
2014-02-16 23:31 ` Dario Bertini
2014-02-17 10:20 ` Thomas Rast
@ 2014-02-18 19:12 ` Junio C Hamano
1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2014-02-18 19:12 UTC (permalink / raw)
To: Dario Bertini; +Cc: git
Dario Bertini <berdario@gmail.com> writes:
> On 02/14/2014 09:03 PM, Junio C Hamano wrote:
>> 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).
>>
>
> Thank you, I was completely unaware of combined diffs. Still: I can't
> see how this would explain the empty diff when deleting 4 lines instead
> of 3.
>
> Also: in the diff output I get 2 hashes, but these are not the hashes of
> the commits, but the contents of the files apparently. One should be
> HEAD (but if I run sha1sum over the file the hash doesn't match), but
A blob object name (or for that matter, names of any type of object)
is not the same as the hash over its contents alone.
See "combined diff format" section of "git diff --help" if you are
interested in reading what the output format is telling you.
> the other can't be the commit which I reverted: the diff is too small...
> or at least this is what I understand
>
> By the way, in the man of git diff there's the briefly mentioned '-m'
> flag. If anyone else reading this mail in the archives is confused by
> the combined diff output, just use "git diff -m HEAD"... I'll probably
> add this in my git aliases
If you are primarily interested in what a merge (or other
mergy-operation like revert) did to your working tree state,
relative to the state it operated on, "git diff HEAD" is most likely
what you want.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-18 19:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-14 19:20 diff weirdness (bug?) Dario Bertini
2014-02-14 20:03 ` Junio C Hamano
2014-02-16 23:31 ` Dario Bertini
2014-02-17 10:20 ` Thomas Rast
2014-02-18 19:12 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).