From nobody Mon Oct 4 16:32:01 2021 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5C76A8D2328 for ; Mon, 4 Oct 2021 16:32:15 +0000 (UTC) (envelope-from russo@bogodyn.org) Received: from bogodyn.org (mail.bogodyn.org [207.224.147.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HNR7y0Dk3z3Ndq for ; Mon, 4 Oct 2021 16:32:13 +0000 (UTC) (envelope-from russo@bogodyn.org) Received: from bogodyn.org (localhost [127.0.0.1]) by bogodyn.org (8.16.1/8.16.1) with ESMTP id 194GW1jX030709; Mon, 4 Oct 2021 10:32:01 -0600 (MDT) (envelope-from russo@bogodyn.org) Received: (from russo@localhost) by bogodyn.org (8.16.1/8.16.1/Submit) id 194GW1vB030708; Mon, 4 Oct 2021 10:32:01 -0600 (MDT) (envelope-from russo) Date: Mon, 4 Oct 2021 10:32:01 -0600 From: Tom Russo To: freebsd-questions@freebsd.org Subject: Re: manually patching a port gets overwritten when the tree updates Message-ID: Reply-To: russo@bogodyn.org References: List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: International Institute for Advanced Quantum Bogodynamical Studies X-Spam-Status: No, score=-5.6 required=5.0 tests=ALL_TRUSTED,BAYES_00,TXREP autolearn=ham autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on bogodyn.org X-Rspamd-Queue-Id: 4HNR7y0Dk3z3Ndq X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of russo@bogodyn.org has no SPF policy when checking 207.224.147.202) smtp.mailfrom=russo@bogodyn.org X-Spamd-Result: default: False [-0.10 / 15.00]; HAS_REPLYTO(0.00)[russo@bogodyn.org]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; REPLYTO_ADDR_EQ_FROM(0.00)[]; TO_DN_NONE(0.00)[]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; HAS_ORG_HEADER(0.00)[]; RCVD_TLS_LAST(0.00)[]; NEURAL_SPAM_SHORT(1.00)[1.000]; DMARC_NA(0.00)[bogodyn.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:209, ipnet:207.224.147.0/24, country:US]; MAILMAN_DEST(0.00)[freebsd-questions] X-ThisMailContainsUnwantedMimeParts: N On Mon, Oct 04, 2021 at 04:12:48PM +0100, we recorded a bogon-computron collision of the flavor, containing: > Hi, > > I thought 'git stash' would take care of this but it doesn't. > > Sometimes a port breaks then a PR is raised and then sometimes someone > posts a patch. I'll apply it to my ports tree 'default' in poudriere and > build the port. If it builds ok I'll run 'git stash' then 'poudriere > ports -u -v' and the ports tree updates. Git stash takes all the current changes, records them so they can be reapplied later, and undoes them, leaving the repo in its state prior to your local changes. > If I don't run 'git stash' the update will fail. So stashing your local changes puts the git repo back in the state it was before you changed anything, and the update works. > But if I try to build the affected port again, after successfully > updating the tree, it's as if the patch was never applied. The same sort > of thing happens with the usual ports tree (in other words, without > poudriere in the equation) That is absolutely the correct behavior. Problem is you haven't reapplied the changes out of the stash afterwards. If you do a "git stash list" you'll find that there is a stash entry for every change you stashed. You can "git stash pop" them one at a time to reapply them (this will remove the stash entry at the same time it's reapplied). Think of the stash as a stack where you store changes that won't be committed and pushed to the repo, and where they can be retrieved as needed. You might want to look at https://git-scm.com/book/en/v2/Git-Tools-Stashing-and-Cleaning if you want to understand the stash better. > I want manually applied patches to remain applied, and I want my ports > tree to stay as current as possible. How is this accomplished? Using git stash is a reasonable way to do it, you just have to remember to pop after you update. And later remember to stash all local changes again before you update the tree. Another option is to maintain your local patches on a branch and keep that branch rebased to main. That's what I do to keep around a handful of patches that I know work for me but that haven't yet made it into the main repo because the package maintainer hasn't accepted them yet. That might require more git play than you're interested in. -- Tom Russo KM5VY Tijeras, NM echo "prpv_a'rfg_cnf_har_cvcr" | sed -e 's/_/ /g' | tr [a-m][n-z] [n-z][a-m]