Skip to content

git remote improvements

Thomas Gummerer git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4remote: use skip_prefixremote.c+3 -64 replies
2/4remote: simplify remote_is_configured()builtin/fetch.c builtin/remote.c remote.c +1 more+12 -223 replies
3/4remote: actually check if remote exitsbuiltin/remote.c t/t5505-remote.sh+20 -21 reply
4/4remote: use remote_is_configured() for add and renamebuiltin/remote.c t/t5505-remote.sh+20 -55 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] git remote improvements

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(-)
Signature · 1 line
2.7.1.410.g6faf27b