git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gummerer <t.gummerer@gmail.com>
To: git@vger.kernel.org
Cc: Johannes.Schindelin@gmx.de, gitster@pobox.com,
	Thomas Gummerer <t.gummerer@gmail.com>
Subject: [PATCH 0/4] git remote improvements
Date: Mon, 15 Feb 2016 18:42:26 +0100	[thread overview]
Message-ID: <1455558150-30267-1-git-send-email-t.gummerer@gmail.com> (raw)

In builtin/remote.c there are a few cases which check whether a remote
exists or not.  These checks are however done inconsistently, and in a
few cases they don't check anything at all.  This patch series tries
to improve the situation.

I stumbled upon this when I mistyped the remote name in git remote rm,
and got a cryptic error message, and thought the other cases might be
worth fixing as well.

There is one such check left in get_remote_ref_states, but I'm not
quite sure what to do about that one.  That function gets called in
git remote show/set-head/prune, where it might make sense for the user
to provide a url, or a local repository, at least in the git remote
show case.

I think we have the following options there:

 (1) just remove the check, as nobody seems to have noticed until now,
     and the check doesn't actually do anything (get_remote() is never
     called with NULL, so it will never return NULL).  In this case
     git dies when a non-existent remote is encountered, e.g. git
     remote show nonexistent existent will die immediately, while git
     remote show existent nonexistent will show info about the
     existing remote, and die afterwards.
     
 (2) add an option not to die in the transport function, and let the
     caller of get_remote_ref_states handle the error i.e. show the
     error and keep going with the next remote.

 (3) anything I might be missing?

Thomas Gummerer (4):
  remote: use skip_prefix
  remote: simplify remote_is_configured()
  remote: actually check if remote exits
  remote: use remote_is_configured() for add and rename

 builtin/fetch.c   |  5 ++---
 builtin/remote.c  | 23 ++++++++++-------------
 remote.c          | 22 +++++-----------------
 remote.h          |  4 ++--
 t/t5505-remote.sh | 36 ++++++++++++++++++++++++++++++++++++
 5 files changed, 55 insertions(+), 35 deletions(-)

-- 
2.7.1.410.g6faf27b

             reply	other threads:[~2016-02-15 17:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 17:42 Thomas Gummerer [this message]
2016-02-15 17:42 ` [PATCH 1/4] remote: use skip_prefix Thomas Gummerer
2016-02-15 18:18   ` Jeff King
2016-02-15 18:35     ` Eric Sunshine
2016-02-15 18:36       ` Jeff King
2016-02-15 20:37     ` Thomas Gummerer
2016-02-15 17:42 ` [PATCH 2/4] remote: simplify remote_is_configured() Thomas Gummerer
2016-02-15 18:21   ` Jeff King
2016-02-15 20:38     ` Thomas Gummerer
2016-02-15 21:37       ` Junio C Hamano
2016-02-15 17:42 ` [PATCH 3/4] remote: actually check if remote exits Thomas Gummerer
2016-02-15 18:23   ` Jeff King
2016-02-15 17:42 ` [PATCH 4/4] remote: use remote_is_configured() for add and rename Thomas Gummerer
2016-02-15 18:33   ` Jeff King
2016-02-15 20:43     ` Thomas Gummerer
2016-02-17 13:54     ` Johannes Schindelin
2016-02-17 14:24       ` Thomas Gummerer
2016-02-17 16:20         ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455558150-30267-1-git-send-email-t.gummerer@gmail.com \
    --to=t.gummerer@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).