{"thread":{"id":"10078","subject":"BUG: git remote show origin => error code 1","startedAt":"2007-09-29T18:13:26Z","lastAt":"2007-09-30T09:54:19Z","messageCount":4,"participants":["Jari Aalto","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"54352","messageId":"ps01nxvd.fsf@blue.sea.net","threadId":"10078","inReplyTo":null,"subject":"BUG: git remote show origin => error code 1","fromName":"Jari Aalto","fromEmail":"jari.aalto@cante.net","sentAt":"2007-09-29T18:13:26Z","receivedAt":"2007-09-29T18:13:26Z","isPatch":false,"sender":{"key":"jari.aalto@cante.net","avatar":"https://avatars.githubusercontent.com/u/34601?v=4"},"body":"\nConsider this:\n\n    $ git remote show origin\n    No such remote origin\n\n    $ echo $?\n    0\n\nPerhaps the code should return non-zero in this case, so that shell\nscripts could use construct:\n\n    git remote show origin; || <another action>\n\nJari\n\n-- \nWelcome to FOSS revolution: we fix and modify until it shines\n"},{"id":"54374","messageId":"7vhcldjeda.fsf@gitster.siamese.dyndns.org","threadId":"10078","inReplyTo":"ps01nxvd.fsf@blue.sea.net","subject":"Re: BUG: git remote show origin => error code 1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-09-29T22:28:17Z","receivedAt":"2007-09-29T22:28:17Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jari Aalto <jari.aalto@cante.net> writes:\n\n> Consider this:\n> ...\n> Jari\n>\n> -- \n> Welcome to FOSS revolution: we fix and modify until it shines\n\nPatches are welcome ;-)\n"},{"id":"54394","messageId":"641soeuv.fsf@blue.sea.net","threadId":"10078","inReplyTo":"ps01nxvd.fsf@blue.sea.net","subject":"[PATCH] prune, rm, show remote: exit with error code 1 on failure","fromName":"Jari Aalto","fromEmail":"jari.aalto@cante.net","sentAt":"2007-09-30T06:18:48Z","receivedAt":"2007-09-30T06:18:48Z","isPatch":true,"sender":{"key":"jari.aalto@cante.net","avatar":"https://avatars.githubusercontent.com/u/34601?v=4"},"body":"- (rm_remote): Return error code 1 on failure.\n- (show_remote): Return error code 1 on failure.\n- (prune_remote): Return error code 1 on failure.\n- (@ARGV eq show):\n  exit in case of 'No such remote'.\n- (@ARGV eq prune):\n- exitin case of 'No such remote'.\n- (@ARGV eq rm):\n- exit in case of 'No such remote'.\n\nSigned-off-by: Jari Aalto <jari.aalto AT cante.net>\n---\n git-remote.perl |   19 +++++++++++++------\n 1 files changed, 13 insertions(+), 6 deletions(-)\n\ndiff --git a/git-remote.perl b/git-remote.perl\nindex b7c1e01..84a9b5c 100755\n--- a/git-remote.perl\n+++ b/git-remote.perl\n@@ -218,7 +218,7 @@ sub prune_remote {\n \tmy ($name, $ls_remote) = @_;\n \tif (!exists $remote->{$name}) {\n \t\tprint STDERR \"No such remote $name\\n\";\n-\t\treturn;\n+\t\treturn 1;\n \t}\n \tmy $info = $remote->{$name};\n \tupdate_ls_remote($ls_remote, $info);\n@@ -235,7 +235,7 @@ sub show_remote {\n \tmy ($name, $ls_remote) = @_;\n \tif (!exists $remote->{$name}) {\n \t\tprint STDERR \"No such remote $name\\n\";\n-\t\treturn;\n+\t\treturn 1;\n \t}\n \tmy $info = $remote->{$name};\n \tupdate_ls_remote($ls_remote, $info);\n@@ -320,7 +320,7 @@ sub rm_remote {\n \tmy ($name) = @_;\n \tif (!exists $remote->{$name}) {\n \t\tprint STDERR \"No such remote $name\\n\";\n-\t\treturn;\n+\t\treturn 1;\n \t}\n \n \t$git->command('config', '--remove-section', \"remote.$name\");\n@@ -381,9 +381,12 @@ elsif ($ARGV[0] eq 'show') {\n \t\tprint STDERR \"Usage: git remote show <remote>\\n\";\n \t\texit(1);\n \t}\n+\tmy $status = 0;\n \tfor (; $i < @ARGV; $i++) {\n-\t\tshow_remote($ARGV[$i], $ls_remote);\n+\t\tmy $ret = show_remote($ARGV[$i], $ls_remote);\n+\t\t$status = $ret if $ret;\n \t}\n+\texit($status);\n }\n elsif ($ARGV[0] eq 'update') {\n \tif (@ARGV <= 1) {\n@@ -409,9 +412,12 @@ elsif ($ARGV[0] eq 'prune') {\n \t\tprint STDERR \"Usage: git remote prune <remote>\\n\";\n \t\texit(1);\n \t}\n+\tmy $status = 0;\n \tfor (; $i < @ARGV; $i++) {\n-\t\tprune_remote($ARGV[$i], $ls_remote);\n+\t\tmy $ret = prune_remote($ARGV[$i], $ls_remote);\n+                $status = $ret if $ret;\n \t}\n+        exit($status);\n }\n elsif ($ARGV[0] eq 'add') {\n \tmy %opts = ();\n@@ -455,7 +461,8 @@ elsif ($ARGV[0] eq 'rm') {\n \t\tprint STDERR \"Usage: git remote rm <remote>\\n\";\n \t\texit(1);\n \t}\n-\trm_remote($ARGV[1]);\n+\tmy $status = rm_remote($ARGV[1]);\n+        exit($status) if $status;\n }\n else {\n \tprint STDERR \"Usage: git remote\\n\";\n-- \n1.5.3.2.81.g17ed\n"},{"id":"54401","messageId":"7vve9sh41g.fsf@gitster.siamese.dyndns.org","threadId":"10078","inReplyTo":"641soeuv.fsf@blue.sea.net","subject":"Re: [PATCH] prune, rm, show remote: exit with error code 1 on failure","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-09-30T09:54:19Z","receivedAt":"2007-09-30T09:54:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n\nBecause this is a bugfix patch, we would want the fix applied to\n'maint' to become part of 1.5.3.4, but your patch contained the\nfix for \"remote rm\" that is not (and will not be) part of 'maint'.\n\nI split the patch into two, applied the bits without \"rm\" part\nto 'maint', merged the result into 'master' and applied the fix\nfor \"rm\" on 'master'.\n"}]}