* Returns 1 if it was the last chop before ':'. */
| 2908 | * Returns 1 if it was the last chop before ':'. |
| 2909 | */ |
| 2910 | static int chop_last_dir(char **remoteurl, int is_relative) |
| 2911 | { |
| 2912 | char *rfind = find_last_dir_sep(*remoteurl); |
| 2913 | if (rfind) { |
| 2914 | *rfind = '\0'; |
| 2915 | return 0; |
| 2916 | } |
| 2917 | |
| 2918 | rfind = strrchr(*remoteurl, ':'); |
| 2919 | if (rfind) { |
| 2920 | *rfind = '\0'; |
| 2921 | return 1; |
| 2922 | } |
| 2923 | |
| 2924 | if (is_relative || !strcmp(".", *remoteurl)) |
| 2925 | die(_("cannot strip one component off url '%s'"), |
| 2926 | *remoteurl); |
| 2927 | |
| 2928 | free(*remoteurl); |
| 2929 | *remoteurl = xstrdup("."); |
| 2930 | return 0; |
| 2931 | } |
| 2932 | |
| 2933 | char *relative_url(const char *remote_url, const char *url, |
| 2934 | const char *up_path) |
no test coverage detected