Re: git remote rename, why dosen't it exists?
- From
Victor Bogado da Silva Lins <victor@bogado.net>
- Date
- Jun 5, 2008, 02:53 UTC
- Message-ID
- <1212634394.13109.10.camel@mithrandir.bogado.net>
- In-Reply-To
- <alpine.DEB.1.00.0806041649270.13507@racer.site.net>
On Wed, 2008-06-04 at 16:51 +0100, Johannes Schindelin wrote:
Show 7 quoted lines
> Hi, > > On Wed, 4 Jun 2008, Victor Bogado da Silva Lins wrote: > > > I trying to refactor [in builtin-remote.c] rm into rm_or_rename, but I > > stumbled into a problem, how do I free a remote struct obtained with > > "remote_get"?
It seems that git-remote thinks that remote_get will return NULL if there is no such remote, but in fact it does not do this, it always alloc a new remote struct and returns that newly allocated. This makes the check useless. In fact that check always succeed, and if you feed a non-existent remote name, the remote-rm will fail later when it tries to remove a non-existent configuration.
The problem now is, how to reliably check if a remote exists or not. The obvious exit is checking if the git configuration has the appropriated key, but I was not able to find out how, the internal git api have no documentation :P. Is there a simple way to check the existence of a key in the git configuration?