You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Nathan Hartman <ha...@gmail.com> on 2020/01/05 20:35:20 UTC

Strange things in git repositories?

Something strange is happening with the git repositories.

Several times recently, I have seen things inexplicably disappear and reappear.

For example:

Commit # 9e091d2027a42fbec14555ae98c76e7579cd8b8e,
"Improvements for NRF52 (#37)"

Adds these files:
* arch/arm/src/nrf52/hardware/nrf52_gpiote.h
* arch/arm/src/nrf52/hardware/nrf52_saadc.h
* arch/arm/src/nrf52/nrf52_i2c.c
* arch/arm/src/nrf52/nrf52_i2c.h

And modifies these files:
* arch/arm/src/nrf52/hardware/nrf52_gpio.h
* arch/arm/src/nrf52/hardware/nrf52_spi.h
* arch/arm/src/nrf52/hardware/nrf52_twi.h
* arch/arm/src/nrf52/hardware/nrf52_uarte.h
* arch/arm/src/nrf52/nrf52_gpio.c
* arch/arm/src/nrf52/nrf52_gpio.h
* arch/arm/src/nrf52/nrf52_lowputc.c
* arch/arm/src/nrf52/nrf52_lowputc.h
* arch/arm/src/nrf52/nrf52_serial.c

Now see the commit after it, 7da409f3b53b4d2607b4551b059abb69ad3ad33b,
"tools/nxstyle.c: Add -r option to check specified range lines"

According to 'git show', it modifies these files:
* tools/README.txt
* tools/nxstyle.c

There is no mention of any other files.

No files are supposed to be added.

No files are supposed to be deleted.

However, try this:

$ git checkout 9e091d2027a42fbec14555ae98c76e7579cd8b8e

$ ls arch/arm/src/nrf52/hardware/nrf52_gpiote.h
arch/arm/src/nrf52/hardware/nrf52_gpiote.h

The file is there. Now checkout the next commit:

$ git checkout 7da409f3b53b4d2607b4551b059abb69ad3ad33b

$ ls arch/arm/src/nrf52/hardware/nrf52_gpiote.h
ls: cannot access 'arch/arm/src/nrf52/hardware/nrf52_gpiote.h': No
such file or directory

The file is gone!

Now checkout the next commit, 3951c4de5af427b204b77ae484fbd8175ed07842:

$ git checkout 3951c4de5af427b204b77ae484fbd8175ed07842
$ ls arch/arm/src/nrf52/hardware/nrf52_gpiote.h
arch/arm/src/nrf52/hardware/nrf52_gpiote.h

The file is back.

Why are files (and modifications) disappearing and reappearing from
one commit to the next?

Nathan

Re: Strange things in git repositories?

Posted by Brennan Ashton <ba...@brennanashton.com>.
> Can we always use "Rebase and merge" here? The "Create a merge
> commit"(default option) generate many empty merge commits which make
> the history hard to read.
>

I would be in favor of this.  I was looking at this earlier and we can
control this with the .asf.yaml file in the repo if we want
See the Merge Buttons sections here
https://cwiki.apache.org/confluence/display/INFRA/.asf.yaml+features+for+git+repositories

The downside is that I frequently GPG sign my commits and this breaks that
if the rebase is needed.  I usually just rebase myself in edit
mode so that I can sign them.

As for the question that was raised earlier in this thread I think there
are some misconceptions about what dates mean in git,
commit or author date are not really going to solve seeing this in a linear
fashion. You need to look at the graph resolution,
especially if you are allowing merge commits (hence why rebase is much
better).  I have an alias that I use for generating the log output

lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold
blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset)
%C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all


Running this you see what is going on, and why you cannot just look at it
in a linear fashion.  This is also visible in the github graph view btw.
Hope this is helpful.

*   5d5897c309 - (4 hours ago) Merge pull request #41 from
wingunder/wingunder_fix_compilation_bug_irq_f7_h7 - patacongo (HEAD ->
master, origin/master, origin/HEAD)
|\
| * 00df2f0fe2 - (5 hours ago) Fixed a compilation error, with irq
debugging for stm32f7 and stm32h7 archs. - Pieter du Preez
* |   7179f2940d - (9 hours ago) Merge pull request #40 from
xiaoxiang781216/fix-shell-script-format - patacongo
|\ \
| * | 3b9efc95a2 - (10 hours ago) Format all shell scripts in tools folder
- Xiang Xiao
|/ /
* | 390ebd504f - (12 hours ago) arch/arm/src/stm32h7:  Port QSPI driver
from STM32F7 to STM32H7 - Minamiya_Natsuki
|/
* 7136215930 - (33 hours ago) sched_mergepending.c:  Correct some errors in
comments. (#38) - patacongo
*   3951c4de5a - (2 days ago) Merge branch 'master' of
github.com:apache/incubator-nuttx
- Gregory Nutt
|\
| * 9e091d2027 - (2 days ago) Improvements for NRF52 (#37) - Mateusz Szafoni
| * d644567dff - (2 days ago) sx127x: fix some coding standard problems
(#36) - Mateusz Szafoni
| * ebce5fb7ca - (2 days ago) Squashed commit of the following: - Gregory
Nutt
| * d612fd3dc5 - (3 days ago) Squashed commit of the following: - Xiang Xiao
* | 7da409f3b5 - (4 days ago) tools/nxstyle.c: Add -r option to check
specified range lines - liuhaitao
|/
* 9b2fa8152c - (3 days ago) drivers/sensors/lsm6dsl.c: fix various compiler
warnings - raiden00pl
* 06c2e86d98 - (3 days ago) Documentation/NuttXCCodingStandard.html:
 Remove requirement to decorate ignored returned values with (void). (#31)
- Gregory Nutt
* 91d483591d - (3 days ago) drivers/modem/altair/altmdm_sys.c:  Fix
modem/altair semaphore related compiler warning - Xiang Xiao
* 0ee8241606 - (3 days ago) Author: Gregory Nutt <gn...@nuttx.org> - jjlange
* f9f8c6a79b - (3 days ago) net/icmp/icmp_netpoll.c: Fix return of
uninitialized 'ret' when no error occurs.  That is, on what should be a
successful return from this function, an uninitialized value was returned,
which may indicate an undeserved error. - Nathan Hartman
*   dfe74fc4cf - (3 days ago) Merge branch 'master' of
github.com:apache/incubator-nuttx
- Gregory Nutt


--Brennan

Re: Strange things in git repositories?

Posted by Xiang Xiao <xi...@gmail.com>.
On Mon, Jan 6, 2020 at 5:02 AM Gregory Nutt <sp...@gmail.com> wrote:
>
>
> > Something strange is happening with the git repositories.
> >
> > Several times recently, I have seen things inexplicably disappear and reappear.
>
> You had me going with that.  The answer is that the order of the commits
> is not in date order.  Look:
>
>     commit 3951c4de5af427b204b77ae484fbd8175ed07842
>     Merge: 7da409f3b5 9e091d2027
>     Author: Gregory Nutt <gn...@nuttx.org>
>     Date:   Sat Jan 4 07:58:30 2020 -0600
>
>          Merge branch 'master' of github.com:apache/incubator-nuttx
>
>     commit 7da409f3b53b4d2607b4551b059abb69ad3ad33b
>     Author: liuhaitao <li...@xiaomi.com>
>     Date:   Thu Jan 2 17:22:08 2020 +0800
>
>     commit 9e091d2027a42fbec14555ae98c76e7579cd8b8e
>     Author: Mateusz Szafoni <ra...@railab.me>
>     Date:   Sat Jan 4 09:44:00 2020 -0300
>
> Is it possible that the local clone was unclean when commit
> 7da409f3b53b4d2607b4551b059abb69ad3ad33b was made?  I did that one, I
> don't think that was ever the case.
>
> Again 'git show 7da409f3b53b4d2607b4551b059abb69ad3ad33b' shows no problem.
>
> 7da409f3b53b4d2607b4551b059abb69ad3ad33b was committed on Jan 2,
> 9e091d2027a42fbec14555ae98c76e7579cd8b8e was committed on Jan 2. So the
> order of the commits in 'git log' does not reflect the date order.
>
> Also lock at the github.com/apache/incubator-nuttx.  Look at the last
> commit.  It has two parents (because it was merged) follow the left
> parent back to 3951c4d:
> https://github.com/apache/incubator-nuttx/commit/3951c4de5af427b204b77ae484fbd8175ed07842
>
> Notice that it has two parents: 7da409f
> <https://github.com/apache/incubator-nuttx/commit/7da409f3b53b4d2607b4551b059abb69ad3ad33b>
> + 9e091d2
> <https://github.com/apache/incubator-nuttx/commit/9e091d2027a42fbec14555ae98c76e7579cd8b8e>
>

Can we always use "Rebase and merge" here? The "Create a merge
commit"(default option) generate many empty merge commits which make
the history hard to read.

> That is where the merge occurred and the two commits from different
> times were merge into commit order.  Try this:
>
>     git log --date-order.
>
> That will be clearly and will behave as you expect, 7da409f
> <https://github.com/apache/incubator-nuttx/commit/7da409f3b53b4d2607b4551b059abb69ad3ad33b>
> and 9e091d2
> <https://github.com/apache/incubator-nuttx/commit/9e091d2027a42fbec14555ae98c76e7579cd8b8e>swap
> positions and if you follow that you will see that nothing disappeared..
> You were jumpting backwared in time
>
> Greg
>
>
>
>

Re: Strange things in git repositories?

Posted by Gregory Nutt <sp...@gmail.com>.
> Something strange is happening with the git repositories.
>
> Several times recently, I have seen things inexplicably disappear and reappear.

You had me going with that.  The answer is that the order of the commits 
is not in date order.  Look:

    commit 3951c4de5af427b204b77ae484fbd8175ed07842
    Merge: 7da409f3b5 9e091d2027
    Author: Gregory Nutt <gn...@nuttx.org>
    Date:   Sat Jan 4 07:58:30 2020 -0600

         Merge branch 'master' of github.com:apache/incubator-nuttx

    commit 7da409f3b53b4d2607b4551b059abb69ad3ad33b
    Author: liuhaitao <li...@xiaomi.com>
    Date:   Thu Jan 2 17:22:08 2020 +0800

    commit 9e091d2027a42fbec14555ae98c76e7579cd8b8e
    Author: Mateusz Szafoni <ra...@railab.me>
    Date:   Sat Jan 4 09:44:00 2020 -0300

Is it possible that the local clone was unclean when commit 
7da409f3b53b4d2607b4551b059abb69ad3ad33b was made?  I did that one, I 
don't think that was ever the case.

Again 'git show 7da409f3b53b4d2607b4551b059abb69ad3ad33b' shows no problem.

7da409f3b53b4d2607b4551b059abb69ad3ad33b was committed on Jan 2, 
9e091d2027a42fbec14555ae98c76e7579cd8b8e was committed on Jan 2. So the 
order of the commits in 'git log' does not reflect the date order.

Also lock at the github.com/apache/incubator-nuttx.  Look at the last 
commit.  It has two parents (because it was merged) follow the left 
parent back to 3951c4d: 
https://github.com/apache/incubator-nuttx/commit/3951c4de5af427b204b77ae484fbd8175ed07842

Notice that it has two parents: 7da409f 
<https://github.com/apache/incubator-nuttx/commit/7da409f3b53b4d2607b4551b059abb69ad3ad33b> 
+ 9e091d2 
<https://github.com/apache/incubator-nuttx/commit/9e091d2027a42fbec14555ae98c76e7579cd8b8e>

That is where the merge occurred and the two commits from different 
times were merge into commit order.  Try this:

    git log --date-order.

That will be clearly and will behave as you expect, 7da409f 
<https://github.com/apache/incubator-nuttx/commit/7da409f3b53b4d2607b4551b059abb69ad3ad33b> 
and 9e091d2 
<https://github.com/apache/incubator-nuttx/commit/9e091d2027a42fbec14555ae98c76e7579cd8b8e>swap 
positions and if you follow that you will see that nothing disappeared.. 
You were jumpting backwared in time

Greg





Re: Strange things in git repositories?

Posted by Gregory Nutt <sp...@gmail.com>.
> I not looked into it in detail, but if may be due to the use of —force, from one of the GitHub messages:
>
No, --force was never used.  There is nothing wrong with the 
repositories.  Nathan is expecting date-order, not commit-order

Re: Strange things in git repositories?

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> This is really  problem that in endemic in open source software. Open source software is developed by people like us 

Git was made for use by repository maintainers, not for developers and certainly not for users. It shows :-)

Thanks,
Justin



Re: Strange things in git repositories?

Posted by Gregory Nutt <sp...@gmail.com>.
> <rant>Yet another example of git's horrendous user interface.
> Bottom-up design at its worst.</rant>

This is really  problem that in endemic in open source software. Open 
source software is developed by people like us -- engineering nerds who 
only care about interesting implementations and are much less skilled in 
understanding or valuing the end-users point of view.  As a result, 
there is a lot of really, really cool open source software that is just 
difficult to use.

If we really wanted our open source software to compete with commercial 
software, we should focus a lot more attention in understanding what 
users want and do a better job of human factors engineering.

It is informative to look at the marketing materials and support tools 
offered by commercial vendors of RTOSs like VxWorks and Integrity.  We 
could learn a lot.


Re: Strange things in git repositories?

Posted by Nathan Hartman <ha...@gmail.com>.
On Sun, Jan 5, 2020 at 4:38 PM Gregory Nutt <sp...@gmail.com> wrote:
> > But the recent commits that I was referring to are shown the same
> > whether --date-order or not.
>
> Sorry, --date-order is the default, commit timestamp order.  I meant
> --author-date-order, author timestamp order.  Summarized:
>
> $ git log
>
> commit 3951c4de5af427b204b77ae484fbd8175ed07842
> Merge: 7da409f3b5 9e091d2027
> Date:   Sat Jan 4 07:58:30 2020 -0600
>
> commit 7da409f3b53b4d2607b4551b059abb69ad3ad33b
> Date:   Thu Jan 2 17:22:08 2020 +0800
>
> commit 9e091d2027a42fbec14555ae98c76e7579cd8b8e
> Author: Mateusz Szafoni <ra...@railab.me>
> Date:   Sat Jan 4 09:44:00 2020 -0300
>
> $ git log --author-date-order
>
> commit 3951c4de5af427b204b77ae484fbd8175ed07842
> Merge: 7da409f3b5 9e091d2027
> Date:   Sat Jan 4 07:58:30 2020 -0600
>
> commit 9e091d2027a42fbec14555ae98c76e7579cd8b8e
> Date:   Sat Jan 4 09:44:00 2020 -0300
>
> commit 7da409f3b53b4d2607b4551b059abb69ad3ad33b
> Date:   Thu Jan 2 17:22:08 2020 +0800

Yes, now I see it. --date-order vs --author-date-order.

<rant>Yet another example of git's horrendous user interface.
Bottom-up design at its worst.</rant>

Thanks for your help,
Nathan

Re: Strange things in git repositories?

Posted by Gregory Nutt <sp...@gmail.com>.
> But the recent commits that I was referring to are shown the same
> whether --date-order or not.

Sorry, --date-order is the default, commit timestamp order.  I meant 
--author-date-order, author timestamp order.  Summarized:

$ git log

commit 3951c4de5af427b204b77ae484fbd8175ed07842
Merge: 7da409f3b5 9e091d2027
Date:   Sat Jan 4 07:58:30 2020 -0600

commit 7da409f3b53b4d2607b4551b059abb69ad3ad33b
Date:   Thu Jan 2 17:22:08 2020 +0800

commit 9e091d2027a42fbec14555ae98c76e7579cd8b8e
Author: Mateusz Szafoni <ra...@railab.me>
Date:   Sat Jan 4 09:44:00 2020 -0300

$ git log --author-date-order

commit 3951c4de5af427b204b77ae484fbd8175ed07842
Merge: 7da409f3b5 9e091d2027
Date:   Sat Jan 4 07:58:30 2020 -0600

commit 9e091d2027a42fbec14555ae98c76e7579cd8b8e
Date:   Sat Jan 4 09:44:00 2020 -0300

commit 7da409f3b53b4d2607b4551b059abb69ad3ad33b
Date:   Thu Jan 2 17:22:08 2020 +0800




Re: Strange things in git repositories?

Posted by Nathan Hartman <ha...@gmail.com>.
On Sun, Jan 5, 2020 at 4:11 PM Nathan Hartman <ha...@gmail.com> wrote:
>
> On Sun, Jan 5, 2020 at 4:04 PM Gregory Nutt <sp...@gmail.com> wrote:
> > > And this is on the MASTER branch!
> > The master branch is perfect!  No problems.
> > > And I wonder, why isn't 'git show' showing this. You think you'll get one
> > > thing when you checkout a commit, then you get other side effects.
> >
> > Get show is working correctly.  But you are making the wrong assumption
> > about the ordering of commits in the repository.
>
> Ok, thank you for clearing that up!
>
> I'll use 'git log --date-order' from now on...

Nope. That gives the same results, almost.

$ git log master --oneline --date-order > date-order.txt
$ git log master --oneline  > commit-order.txt
$ diff date-order.txt commit-order.txt

Everything identical for the first 8696 commits listed.

Only at commit c3d76d56bc there is one change of ordering, and then
some others much farther down the list.

But the recent commits that I was referring to are shown the same
whether --date-order or not.

Hmmm

Nathan

Re: Strange things in git repositories?

Posted by Nathan Hartman <ha...@gmail.com>.
On Sun, Jan 5, 2020 at 4:04 PM Gregory Nutt <sp...@gmail.com> wrote:
> > And this is on the MASTER branch!
> The master branch is perfect!  No problems.
> > And I wonder, why isn't 'git show' showing this. You think you'll get one
> > thing when you checkout a commit, then you get other side effects.
>
> Get show is working correctly.  But you are making the wrong assumption
> about the ordering of commits in the repository.

Ok, thank you for clearing that up!

I'll use 'git log --date-order' from now on...

I suppose this was never necessary in the past because you were the
only one making commits...

Thanks again,
Nathan

Re: Strange things in git repositories?

Posted by Gregory Nutt <sp...@gmail.com>.
> And this is on the MASTER branch!
The master branch is perfect!  No problems.
> And I wonder, why isn't 'git show' showing this. You think you'll get one
> thing when you checkout a commit, then you get other side effects.

Get show is working correctly.  But you are making the wrong assumption 
about the ordering of commits in the repository.

Greg


Re: Strange things in git repositories?

Posted by Nathan Hartman <ha...@gmail.com>.
On Sun, Jan 5, 2020 at 3:49 PM Justin Mclean <ju...@classsoftware.com>
wrote:

> HI,
>
> I not looked into it in detail, but if may be due to the use of —force,
> from one of the GitHub messages:
>
> "This update added new revisions after undoing existing revisions.
> That is to say, some revisions that were in the old version of the
> branch are not in the new version.  This situation occurs
> when a user --force pushes a change and generates a repository
> containing something like this:”


And this is on the MASTER branch!

And I wonder, why isn't 'git show' showing this. You think you'll get one
thing when you checkout a commit, then you get other side effects.

Nathan

Re: Strange things in git repositories?

Posted by Justin Mclean <ju...@classsoftware.com>.
HI,

I not looked into it in detail, but if may be due to the use of —force, from one of the GitHub messages:

"This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:”

Thanks,
Justin