Wireshark-dev: Re: [Wireshark-dev] Trouble uploading Wireshark enhancement

From: Graham Bloice <graham.bloice@xxxxxxxxxxxxx>
Date: Fri, 23 Oct 2020 15:05:57 +0100
As Japp noted we now have a repository triangle:
  • The main Wireshark repository referred to as upstream: git@xxxxxxxxxx:wireshark/wireshark.git
  • Your 'fork' of the main repository, referred to as downstream: git@xxxxxxxxxx:<your.username>/wireshark.git
  • Your local repository, cloned from your fork.
The Wiki page on Submitting Patches has a section on setup: https://gitlab.com/wireshark/wireshark/-/wikis/Development/SubmittingPatches#setup

which details the setup with explaining it too much.

On Fri, 23 Oct 2020 at 14:12, Fulko Hew <fulko.hew@xxxxxxxxx> wrote:


On Fri, Oct 23, 2020 at 2:07 AM Jaap Keuter <jaap.keuter@xxxxxxxxx> wrote:

On 23 Oct 2020, at 04:21, Fulko Hew <fulko.hew@xxxxxxxxx> wrote:

I've enhanced a Lua based dissector, and have also rewritten it
in 'C' so that it can be included in the next release of Wireshark.

Now I'm trying to submit it.  My last submission was back in 2007,
and things have changed a little since then.

I believe? the latest doc on how to submit changes are in:


After being a developer for 45 years, I never had to use git until now, so I'll
admit I don't know anything about git, and I'm trying to follow those instructions.

I got to the point of 'commit' and then 'git push downstream +HEAD'
and I get the error:

fatal: 'downstream' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What am I doing wrong?



Hi,

Indeed _a lot_ has changed over time, and we’re still shaking a little from the latest transition to GitLab. As a result the guidance and documentation is not yet settled. One of the things we as a group need to finalise is how we imagine the repository setup for developers to be. This is because in this case (i.e., with sites like GitLab and GitHub) you work with a ‘repository triangle’. This means you have the repo of the project (Wireshark), the 'fork' of the project on the web service's site, and your clone of the repo. Your clone of the repo can either be from the project repo, or from your forks repo. Either way, the repo you cloned from is referred to as ‘origin’. If you clone from the project repo you have no relation to your fork, in the web service. That is were you can add a remote for your clone, and this is imagined to be ‘downstream’. This is ‘somewhat’ described in the section ‘Migrating form Gerrit’ but that is also not completely suitable. As said the documentation is not yet settled. Anyway, depending on where you cloned from (project repo, or your clone), you can add a remote (downstream or upstream respectively) and use the name pointing to your clone to push to. 

Hope it makes sense,

Yes, and no.  I believe I understand the relationships, but what I have trouble groking
is the how the git commands relate to what I need to do, or how they're composed,
and a visual of those commands and their relation to upstream and downstream.

1/ Probably the first issue was that I was supposed to 'fork'.  But I couldn't find
   the 'fork' button on the web site (as per instructions) that I was supposed to use .
   So I went with 'clone'.
   (Clone ... fork ... for me, they're different, but to someone else perhaps they mean the same thing.)

2/ [I think I deleted my 'clone' project on GitLab, because I still couldn't upload to it
   so I never got to the issue of merge-ing it with the master?)

3/ Also the part about git commit... and what I see in the vi session, a 'file'
   containing a bunch of comments, and what was I supposed to do with it, let alone
   where I'm supposed to put the 'commit message'.

If that's wrong, then I need better (more specific git) instructions on how to get out
of the situation I'm in.

What I did till now:

[fhew@localhost ~]$ git clone -o upstream git@xxxxxxxxxx:wireshark/wireshark.git
Cloning into 'wireshark'...
remote: Enumerating objects: 2404, done.
remote: Counting objects: 100% (2404/2404), done.
remote: Compressing objects: 100% (1068/1068), done.
remote: Total 616592 (delta 1520), reused 2189 (delta 1333), pack-reused 614188
Receiving objects: 100% (616592/616592), 601.24 MiB | 2.34 MiB/s, done.
Resolving deltas: 100% (493016/493016), done.
Checking out files: 100% (6123/6123), done.
[fhew@localhost ~]$ cd wireshark
[fhew@localhost wireshark]$ cp tools/pre-commit .git/hooks
[fhew@localhost wireshark]$ chmod a+x .git/hooks/pre-commit
[fhew@localhost wireshark]$ git checkout -b TP-Link-SmartHome-dissector upstream/master
Branch TP-Link-SmartHome-dissector set up to track remote branch master from upstream.
Switched to a new branch 'TP-Link-SmartHome-dissector'

   # I then added my new file into my local 'clone' epan/dissectors/packet-tplink-smarthome.c,
   # and added my entry to epan/dissectors/CMakeLists.txt for that file
   # built Wireshark using ninja, and tested it.

$ git commit
On branch TP-Link-SmartHome-dissector
Your branch is ahead of 'upstream/master' by 2 commits.
  (use "git push" to publish your local commits)
Changes not staged for commit:
        modified:   epan/dissectors/packet-tplink-smarthome.c

no changes added to commit
[fhew@localhost wireshark-working]$ git push downstream HEAD
fatal: 'downstream' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
[fhew@localhost wireshark-working]$ git commit -a --amend
[TP-Link-SmartHome-dissector 1b8b609847] Adding dissector support for TP-Link SmartHome protocol
 Date: Thu Oct 22 19:49:15 2020 -0400
 2 files changed, 52 insertions(+), 51 deletions(-)
[fhew@localhost wireshark-working]$ git push downstream +HEAD
fatal: 'downstream' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


--
Graham Bloice