threads / discuss / 22789

git-push segfault

Subject: git-push segfault

## tl;dr

6 messages between Feb 24, 2010 and Feb 24, 2010.

replies: 5people: 3as markdown or json

Dale Rowley· Feb 24, 2010, 06:02 UTC · re: Dale Rowley · lore

Re: git-push segfault

Dale Rowley <ddrowley3 <at> juno.com> writes:
> git config --unset branch.master.remote
> git push

Yes, those 2 commands don't make much sense. I should have mentioned that this was just the simplest way to reproduce the problem. My original and more realistic scenario:

git clone /path/to/some/repo cd repo git remote add remote1 <url> git remote add remote2 <url> git config --unset branch.master.remote git push remote1 (seg fault)

The reason for unsetting branch.master.remote was to force git to complain and abort if I accidentally typed 'git push' instead of 'git push <remote>' (I wanted to avoid accidentally pushing to the wrong remote repo).

Dale
Jeff King· Feb 24, 2010, 06:36 UTC · re: Dale Rowley · lore

Re: git-push segfault

On Wed, Feb 24, 2010 at 03:46:37AM +0000, Dale Rowley wrote:
Show 9 quoted lines
> Steps to reproduce:
> 
> git clone /path/to/some/repo
> cd repo
> git config --unset branch.master.remote
> git push
> (seg fault)
> 
> I'm using version 1.7.0.
I can't reproduce here, using the following script:

-- >8 -- #!/bin/sh

rm -rf parent child
mkdir parent && (
  cd parent &&
  git init
) &&
git clone parent child &&
cd child &&
git config --unset branch.master.remote &&
git push
-- 8< --

Does that trigger the problem for you? If not, can you show what is different between your earlier reproduction recipe and this one?

-Peff
Andreas Krey· Feb 24, 2010, 08:22 UTC · re: Jeff King · lore

Re: git-push segfault

On Wed, 24 Feb 2010 01:36:06 +0000, Jeff King wrote: ...

> #!/bin/sh
...
> git clone parent child &&
> cd child &&
How about 'set -xe' instead of all the &&?
Andreas
Jeff King· Feb 24, 2010, 09:23 UTC · re: Andreas Krey · lore

Re: git-push segfault

On Wed, Feb 24, 2010 at 09:22:14AM +0100, Andreas Krey wrote:
Show 8 quoted lines
> On Wed, 24 Feb 2010 01:36:06 +0000, Jeff King wrote:
> ...
> > #!/bin/sh
> ...
> > git clone parent child &&
> > cd child &&
> 
> How about 'set -xe' instead of all the &&?

I long ago stopped trying to remember all of the places where "-e" works and where it doesn't, and just use explicit "&&" (or "|| exit 1"). For example, the subshell in my recipe needs an explicit error check under dash, but will exit correctly using bash. I seem to recall there are some other gotchas, but it has been a long time since I looked.

At any rate, this is not even code for inclusion in git. It is "please cut and paste this and tell me if it breaks". So I am not too worried about style.

-Peff
Andreas Krey· Feb 24, 2010, 10:49 UTC · re: Jeff King · lore

Re: git-push segfault

On Wed, 24 Feb 2010 04:23:57 +0000, Jeff King wrote:
> On Wed, Feb 24, 2010 at 09:22:14AM +0100, Andreas Krey wrote:
...
> > How about 'set -xe' instead of all the &&?
...
> At any rate, this is not even code for inclusion in git.

That was why I was asking. In throwaway scripts -e as well as -x is rather practical (esp. the latter); I wouldn't use that in 'real' scripts. Probably it's better not to set a bad example in posted throwaway scripts, though. :-)

Andreas

← back to recent threads