Board index FlightGear Support Compiling

'git status' misleading?

Building FlightGear from source, and in the need for help?

'git status' misleading?

Postby MariuszXC » Fri Aug 20, 2021 2:06 pm

I downloaded and compiled 'next' some time ago with download_and_compile.sh. All went well.

Today I wanted to update my copy, so I went to the directory with FG source and issued:
Code: Select all
compile/fg_next/flightgear$ git status
On branch next
Your branch is up-to-date with 'origin/next'.
nothing to commit, working directory clean

however, just to be sure, I then issued:
Code: Select all
compile/fg_next/flightgear$ git pull
remote: Enumerating objects: 36, done.
remote: Counting objects: 100% (36/36), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 23 (delta 19), reused 0 (delta 0)
Unpacking objects: 100% (23/23), done.
From https://git.code.sf.net/p/flightgear/flightgear
   96b9cfa..4bf88a0  next       -> origin/next
Updating 96b9cfa..4bf88a0
Fast-forward
 src/GUI/MapWidget.cxx                               |  2 ++
 src/GUI/property_list.cxx                           |  2 +-
 src/Instrumentation/HUD/HUD_gauge.cxx               | 21 +++++++++++----------
 test_suite/unit_tests/Navaids/test_routeManager.cxx | 30 ++++++++++++++++++++++++++++++
 test_suite/unit_tests/Navaids/test_routeManager.hxx |  2 ++
 5 files changed, 46 insertions(+), 11 deletions(-)

So, obviously, there were commits ahead of my copy, however 'git status' claimed "Your branch is up-to-date with 'origin/next'". What gives? Is this the expected behaviour of 'git status'?
INOP
MariuszXC
 
Posts: 1061
Joined: Tue May 18, 2021 5:38 pm
Location: Europe
Callsign: SP-MRM
Version: 2020.4
OS: Ubuntu 16.04

Re: 'git status' misleading?

Postby ludomotico » Fri Aug 20, 2021 2:20 pm

This is not specific to FlightGear, this is how git works.

Yes, it is the expected behaviour

Check: https://stackoverflow.com/questions/278 ... t-upstream
User avatar
ludomotico
 
Posts: 1269
Joined: Tue Apr 24, 2012 2:01 pm
Version: nightly
OS: Windows 10

Re: 'git status' misleading?

Postby MariuszXC » Fri Aug 20, 2021 2:45 pm

Thank you, now I understand why.
I was mislead by this guide: https://github.com/git-guides/git-status
especially by this statement:
"If your current local branch is linked to a remote branch, then git status will tell you if your local branch is behind or ahead by any commits"

P.S.: judging by the stackoverflow comments I was not the only one confused by this particular git message. Makes me feel a bit better ;)
INOP
MariuszXC
 
Posts: 1061
Joined: Tue May 18, 2021 5:38 pm
Location: Europe
Callsign: SP-MRM
Version: 2020.4
OS: Ubuntu 16.04

Re: 'git status' misleading?

Postby Johan G » Sat Aug 21, 2021 12:14 pm

As I understand it "git status" is more about if you have made any changes compared to "HEAD" when working on something, in essence if there is anything to add and commit.

Note: I tend to use git a lot, but locally. Being able to have a good history with motivation of why you did things a certain way, and also being able to step back is useful in many circumstances.
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: 'git status' misleading?

Postby MariuszXC » Sat Aug 21, 2021 1:27 pm

Yes, I get it now. It was the false assumption of a local copy being linked to a remote branch, which caused the confusion.
For me, CVS and SVN were more of a usual environment. Git is radically different at times.

While we are talking about git, I have another side question. If I download a FG aircraft model from github I have two options, either download a zip file or clone the repo. The difference is in size of downloaded data.

Let us take Cessna 172p as an example.

Cloning the repo with git clone https://github.com/c172p-team/c172p.git results in a directory taking
$ du -s git/c172p/
1576884 git/c172p/

while a downloaded zip is:
$ ls -lh c172p-master.zip
-rw-rw-r-- 1 mrm mrm 167M sie 21 14:11 c172p-master.zip

which unzips to a directory of size:
$ du -s c172p-master/
246460 c172p-master

So 241MB against 1540MB, which is quite sizable difference, both disk space and bandwidth wise.

So my question is: how can I use git clone to get only the current files, without all the project history?
I would prefer to use git clone rather than the zip method, for ease of updates.
INOP
MariuszXC
 
Posts: 1061
Joined: Tue May 18, 2021 5:38 pm
Location: Europe
Callsign: SP-MRM
Version: 2020.4
OS: Ubuntu 16.04

Re: 'git status' misleading?

Postby wkitty42 » Sat Aug 21, 2021 2:46 pm

you can clone and pull only one or a few of the latest commits... this is called "shallow cloning"...

Code: Select all
git clone --depth 1 https://some.repo/here ~/my/clone/directory

or something like that... check git docs to be sure...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9148
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04


Return to Compiling

Who is online

Users browsing this forum: No registered users and 5 guests