{"thread":{"id":"36031","subject":"[PATCH v5] branch.c: change install_branch_config() to use skip_prefix()","startedAt":"2014-03-03T09:15:55Z","lastAt":"2014-03-03T09:15:55Z","messageCount":1,"participants":["Guanglin Xu"],"isPatch":true,"patchVersion":5,"patchTotal":null},"messages":[{"id":"235852","messageId":"1393838155-56591-1-git-send-email-mzguanglin@gmail.com","threadId":"36031","inReplyTo":null,"subject":"[PATCH v5] branch.c: change install_branch_config() to use skip_prefix()","fromName":"Guanglin Xu","fromEmail":"mzguanglin@gmail.com","sentAt":"2014-03-03T09:15:55Z","receivedAt":"2014-03-03T09:15:55Z","isPatch":true,"sender":{"key":"mzguanglin@gmail.com","avatar":"https://gravatar.com/avatar/fb3a07ac20762e91fec45813fa7b91f5497c3ed748441e9d14e888900d5653c0?d=mp&s=160"},"body":"to avoid a magic code of 11.\n\nHelped-by: Sun He <sunheeh...@gmail.com>\nHelped-by: Eric Sunshine <sunsh...@sunshineco.com>\nHelped-by: Jacopo Notarstefano <jaco...@gmail.com>\n\nSigned-off-by: Guanglin Xu <mzguanglin@gmail.com>\n---\n\nThis is an implementation of the idea#2 of GSoC 2014 microproject.\n\n branch.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/branch.c b/branch.c\nindex 723a36b..fae7715 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -49,8 +49,8 @@ static int should_setup_rebase(const char *origin)\n \n void install_branch_config(int flag, const char *local, const char *origin, const char *remote)\n {\n-\tconst char *shortname = remote + 11;\n-\tint remote_is_branch = starts_with(remote, \"refs/heads/\");\n+\tconst char *shortname = skip_prefix(remote ,\"refs/heads/\");\n+\tint remote_is_branch = !!shortname;\n \tstruct strbuf key = STRBUF_INIT;\n \tint rebasing = should_setup_rebase(origin);\n \n-- \n1.9.0\n"}]}