* [patch] contrib: Don't add push rules for personal and vendor spaces.
@ 2020-01-14 16:47 Richard Earnshaw (lists)
2020-01-15 12:12 ` Richard Earnshaw (lists)
0 siblings, 1 reply; 6+ messages in thread
From: Richard Earnshaw (lists) @ 2020-01-14 16:47 UTC (permalink / raw)
To: GCC Patches; +Cc: Jonathan Wakely
[-- Attachment #1: Type: text/plain, Size: 927 bytes --]
Originally, it seemed like a good idea to add automatic 'push' rules
to the git configuration, so that personal- and vendor-space commits
would automatically push to the right place. Unfortunately, this
changes git's behaviour and with these settings "git push" will try to
push all branches in a local tree up to the corresponding location on
the server (ignoring the push.default setting). The only known
mitigation for this is to ALWAYS use "git push <server> <branch>".
So instead, we no-longer add those rules by default and will document
the options on the wiki. We don't automatically remove the push
entries but do print out the command that will do so, if the user so
wishes.
OK?
* gcc-git-customization.sh: Explain why we want the user's
upstream account name. Don't add push rules. Check if push rules
have been added and suggest that they should be removed.
* git-fetch-vendor.sh: Don't add push rules.
[-- Attachment #2: custom.patch --]
[-- Type: text/x-patch, Size: 2411 bytes --]
diff --git a/contrib/gcc-git-customization.sh b/contrib/gcc-git-customization.sh
index 3b9d79d3d38..dae2c35bb57 100755
--- a/contrib/gcc-git-customization.sh
+++ b/contrib/gcc-git-customization.sh
@@ -55,7 +55,7 @@ then
fi
fi
fi
-ask "Account name on gcc.gnu.org" $remote_id remote_id
+ask "Account name on gcc.gnu.org (for your personal branches area)" $remote_id remote_id
git config "gcc-config.user" "$remote_id"
old_pfx=`git config --get "gcc-config.userpfx"`
@@ -71,4 +71,19 @@ git config "gcc-config.userpfx" "$new_pfx"
echo "Setting up tracking for personal namespace $remote_id in remotes/$upstream/${new_pfx}"
git config --replace-all "remote.${upstream}.fetch" "+refs/users/${remote_id}/heads/*:refs/remotes/${upstream}/${new_pfx}/*" ":refs/remotes/${upstream}/${old_pfx}/"
git config --replace-all "remote.${upstream}.fetch" "+refs/users/${remote_id}/tags/*:refs/tags/${new_pfx}/*" ":refs/tags/${old_pfx}/"
-git config --replace-all "remote.${upstream}.push" "refs/heads/${new_pfx}/*:refs/users/${remote_id}/heads/*" "^\+?refs/heads/${old_pfx}/"
+
+push_rule=`git config --get "remote.${upstream}.push"`
+if [ "x$push_rule" != "x" ]
+then
+ echo "***********************************************"
+ echo " Warning"
+ echo "***********************************************"
+ echo
+ echo "Old versions of this script used to add custom push"
+ echo "rules to simplify pushing to personal branches."
+ echo "Your configuration contains such rules, but we no-longer"
+ echo "recommend doing this."
+ echo
+ echo "To delete these rules run:"
+ echo " git config --unset-all \"remote.${upstream}.push\""
+fi
diff --git a/contrib/git-fetch-vendor.sh b/contrib/git-fetch-vendor.sh
index 5e1b1f0a854..d2d3ed56ad7 100755
--- a/contrib/git-fetch-vendor.sh
+++ b/contrib/git-fetch-vendor.sh
@@ -15,8 +15,6 @@ then
fi
echo "setting up git to fetch vendor ${vendor} to remotes/${upstream}/${vendor}"
-
git config --replace-all "remote.${upstream}.fetch" "+refs/vendors/${vendor}/heads/*:refs/remotes/${upstream}/${vendor}/*" ":refs/remotes/${upstream}/${vendor}/"
git config --replace-all "remote.${upstream}.fetch" "+refs/vendors/${vendor}/tags/*:refs/tags/${vendor}/*" ":refs/tags/${vendor}/"
-git config --replace-all "remote.${upstream}.push" "+refs/heads/${vendor}/*:refs/vendors/${vendor}/heads/*" "^\+refs/heads/${vendor}/"
git fetch
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] contrib: Don't add push rules for personal and vendor spaces.
2020-01-14 16:47 [patch] contrib: Don't add push rules for personal and vendor spaces Richard Earnshaw (lists)
@ 2020-01-15 12:12 ` Richard Earnshaw (lists)
2020-01-15 23:51 ` Joseph Myers
0 siblings, 1 reply; 6+ messages in thread
From: Richard Earnshaw (lists) @ 2020-01-15 12:12 UTC (permalink / raw)
To: GCC Patches; +Cc: Jonathan Wakely
On 14/01/2020 14:55, Richard Earnshaw (lists) wrote:
> Originally, it seemed like a good idea to add automatic 'push' rules
> to the git configuration, so that personal- and vendor-space commits
> would automatically push to the right place. Unfortunately, this
> changes git's behaviour and with these settings "git push" will try to
> push all branches in a local tree up to the corresponding location on
> the server (ignoring the push.default setting). The only known
> mitigation for this is to ALWAYS use "git push <server> <branch>".
>
> So instead, we no-longer add those rules by default and will document
> the options on the wiki. We don't automatically remove the push
> entries but do print out the command that will do so, if the user so
> wishes.
>
> OK?
>
> * gcc-git-customization.sh: Explain why we want the user's
> upstream account name. Don't add push rules. Check if push rules
> have been added and suggest that they should be removed.
> * git-fetch-vendor.sh: Don't add push rules.
>
I've now checked this in.
R.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] contrib: Don't add push rules for personal and vendor spaces.
2020-01-15 12:12 ` Richard Earnshaw (lists)
@ 2020-01-15 23:51 ` Joseph Myers
2020-01-16 15:59 ` Jason Merrill
2020-01-16 16:01 ` Jakub Jelinek
0 siblings, 2 replies; 6+ messages in thread
From: Joseph Myers @ 2020-01-15 23:51 UTC (permalink / raw)
To: Richard Earnshaw (lists); +Cc: GCC Patches, Jonathan Wakely
A reasonable replacement for those push rules might be command aliases
(e.g. "git upush <branch>" to push the user branch <branch>).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] contrib: Don't add push rules for personal and vendor spaces.
2020-01-15 23:51 ` Joseph Myers
@ 2020-01-16 15:59 ` Jason Merrill
2020-01-16 16:01 ` Jakub Jelinek
1 sibling, 0 replies; 6+ messages in thread
From: Jason Merrill @ 2020-01-16 15:59 UTC (permalink / raw)
To: Joseph Myers; +Cc: Richard Earnshaw (lists), GCC Patches, Jonathan Wakely
On Wed, Jan 15, 2020 at 5:56 PM Joseph Myers <joseph@codesourcery.com>
wrote:
> A reasonable replacement for those push rules might be command aliases
> (e.g. "git upush <branch>" to push the user branch <branch>).
>
And/or git mpush for push origin HEAD:master
Jason
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] contrib: Don't add push rules for personal and vendor spaces.
2020-01-15 23:51 ` Joseph Myers
2020-01-16 15:59 ` Jason Merrill
@ 2020-01-16 16:01 ` Jakub Jelinek
2020-01-17 13:19 ` Richard Earnshaw (lists)
1 sibling, 1 reply; 6+ messages in thread
From: Jakub Jelinek @ 2020-01-16 16:01 UTC (permalink / raw)
To: Joseph Myers; +Cc: Richard Earnshaw (lists), GCC Patches, Jonathan Wakely
On Wed, Jan 15, 2020 at 10:48:23PM +0000, Joseph Myers wrote:
> A reasonable replacement for those push rules might be command aliases
> (e.g. "git upush <branch>" to push the user branch <branch>).
Would we have then separate aliases for pushing to one vendor branch and
another vendor branch?
Couldn't one alias determine from the branch remote and merge and
perhaps the fetch rules figure out the right git push arguments
given the setup (e.g. treat $(git config --get gcc-config.userpfx)
and $(git config --get gcc-config.user) as push to user branch,
devel/*, master, releases/* as normal git push and the rest as vendors
(or let git-fetch-vendor.sh record list of all used vendors in some gcc-config
setting)?
Jakub
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] contrib: Don't add push rules for personal and vendor spaces.
2020-01-16 16:01 ` Jakub Jelinek
@ 2020-01-17 13:19 ` Richard Earnshaw (lists)
0 siblings, 0 replies; 6+ messages in thread
From: Richard Earnshaw (lists) @ 2020-01-17 13:19 UTC (permalink / raw)
To: Jakub Jelinek, Joseph Myers; +Cc: GCC Patches, Jonathan Wakely
On 16/01/2020 15:00, Jakub Jelinek wrote:
> On Wed, Jan 15, 2020 at 10:48:23PM +0000, Joseph Myers wrote:
>> A reasonable replacement for those push rules might be command aliases
>> (e.g. "git upush <branch>" to push the user branch <branch>).
>
> Would we have then separate aliases for pushing to one vendor branch and
> another vendor branch?
> Couldn't one alias determine from the branch remote and merge and
> perhaps the fetch rules figure out the right git push arguments
> given the setup (e.g. treat $(git config --get gcc-config.userpfx)
> and $(git config --get gcc-config.user) as push to user branch,
> devel/*, master, releases/* as normal git push and the rest as vendors
> (or let git-fetch-vendor.sh record list of all used vendors in some gcc-config
> setting)?
>
> Jakub
>
I think the new proposed remotes structure should eliminate most of the
concerns about unsafe push rules; at worst you will only push everything
related to the 'remote' that your current branch is on.
So I think having more aliases is now unnecessary.
R.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-01-17 11:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-14 16:47 [patch] contrib: Don't add push rules for personal and vendor spaces Richard Earnshaw (lists)
2020-01-15 12:12 ` Richard Earnshaw (lists)
2020-01-15 23:51 ` Joseph Myers
2020-01-16 15:59 ` Jason Merrill
2020-01-16 16:01 ` Jakub Jelinek
2020-01-17 13:19 ` Richard Earnshaw (lists)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).