Help with git for testing Addon Manager

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Help with git for testing Addon Manager

Post by adrianinsaval »

chennes wrote: Tue Aug 09, 2022 9:07 pm Using which command?
maybe

Code: Select all

git rev-list --count master...origin/master
the remote has to be fetched up to date for this. Check other options of this command if the output of --count is not satisfactory. It's probably a good idea to programmatically get the correct tracked branch and local branch that need to be compared rather than just assuming it's the default.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Help with git for testing Addon Manager

Post by adrianinsaval »

chennes wrote: Tue Aug 09, 2022 9:16 pm Oh sorry -- although it does do a fetch every time, it's really looking at the output of git status to determine the up-to-date status. Nevertheless, if I specifically reset to a specific revision, git status returns nothing.
Ah that's probably a better option, in my testing after resetting to a prior commit I do get the info by running

Code: Select all

git status --ahead-behind
example output:

Code: Select all

On branch master
Your branch is behind 'origin/master' by 2 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

nothing to commit, working tree clean
edit: running git status on its own also shows the same output but this might be something dependent on the local config so it's better to explicitly ask for it IMO.
User avatar
chennes
Veteran
Posts: 3876
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Help with git for testing Addon Manager

Post by chennes »

It's not working for me yet: when I do a hard reset to a specific revision, git status doesn't give me any results...

Code: Select all

chennes@chrismaclaptop 3DfindIT % git reset --hard b9ab38a                   
HEAD is now at b9ab38a Make sure to execute javascript from the main thread.
chennes@chrismaclaptop 3DfindIT % git status --ahead-behind                 
On branch master
nothing to commit, working tree clean
And rev-list gives:

Code: Select all

chennes@chrismaclaptop 3DfindIT % git rev-list --count master...origin/master
fatal: ambiguous argument 'master...origin/master': unknown revision or path not in the working tree.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Help with git for testing Addon Manager

Post by adrianinsaval »

do you have the remote properly configured and the correct tracking branch set? That is very weird.
User avatar
chennes
Veteran
Posts: 3876
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Help with git for testing Addon Manager

Post by chennes »

The Addon Manager doesn't do any configuration beyond just doing a plain "git clone", so that's what I've got.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Help with git for testing Addon Manager

Post by adrianinsaval »

Code: Select all

adrian@DESKTOP-PAKQOHR:~$ git clone https://github.com/cadenasgmbh/3dfindit-freecad-integration
Cloning into '3dfindit-freecad-integration'...
remote: Enumerating objects: 149, done.
remote: Counting objects: 100% (149/149), done.
remote: Compressing objects: 100% (101/101), done.
remote: Total 149 (delta 75), reused 89 (delta 33), pack-reused 0
Receiving objects: 100% (149/149), 338.65 KiB | 281.00 KiB/s, done.
Resolving deltas: 100% (75/75), done.
adrian@DESKTOP-PAKQOHR:~$ cd 3dfindit-freecad-integration/
adrian@DESKTOP-PAKQOHR:~/3dfindit-freecad-integration$ git reset --hard b9ab38a
HEAD is now at b9ab38a Make sure to execute javascript from the main thread.
adrian@DESKTOP-PAKQOHR:~/3dfindit-freecad-integration$ git status --ahead-behind
On branch master
Your branch is behind 'origin/master' by 6 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

nothing to commit, working tree clean
adrian@DESKTOP-PAKQOHR:~/3dfindit-freecad-integration$
:? :?
could it be due to git version? this is running 2.25.1 in ubuntu 20.04
fatal: ambiguous argument 'master...origin/master': unknown revision or path not in the working tree.
this suggests the remote is not called origin in your clone though, what's the output of

Code: Select all

git status -sb --porcelain
this could be easier to parse, here it gives:
## master...origin/master [behind 6]
User avatar
chennes
Veteran
Posts: 3876
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Help with git for testing Addon Manager

Post by chennes »

Maybe, I am running 2.32.1 on Mac OS. I just tested on Windows with 2.29.2 and the normal "get status" gives me your results. Adding "--porcelain" still gives nothing, which is unfortunate, and I'm a little concerned about the inconsistency.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
chennes
Veteran
Posts: 3876
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Help with git for testing Addon Manager

Post by chennes »

adrianinsaval wrote: Wed Aug 10, 2022 3:30 pm

Code: Select all

git status -sb --porcelain
this could be easier to parse, here it gives:
## master...origin/master [behind 6]
It works beautifully on my Windows machine, but on the Mac I just get "##master" -- I wonder if there's something wrong with git version 2.32.1 (Apple Git-133).
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Help with git for testing Addon Manager

Post by adrianinsaval »

looks like it doens't have a tracking branch, did you try in a newly cloned repo or is this always in the same repo? What's the output of

Code: Select all

git branch -a
?
User avatar
chennes
Veteran
Posts: 3876
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Help with git for testing Addon Manager

Post by chennes »

Code: Select all

* master
So maybe this is just something like a really old checkout, or I've broken it, or something
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Post Reply